inspectionTableFormat.ml 1.84 KB
Newer Older
1 2 3 4 5 6 7
(* This signature defines the format of the tables that are produced (in
   addition to the tables described in [TableFormat]) when the command line
   switch [--inspection] is enabled. It is used as an argument to
   [InspectionTableInterpreter.Make]. *)

module type TABLES = sig

8
  (* The types of symbols. *)
9

10
  include IncrementalEngine.SYMBOLS
11

12 13
  (* The type ['a lr1state] describes an LR(1) state. The generated parser defines
     it internally as [int]. *)
14

15
  type 'a lr1state
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45

  (* Some of the tables that follow use encodings of (terminal and
     nonterminal) symbols as integers. So, we need functions that
     map the integer encoding of a symbol to its algebraic encoding. *)

  val    terminal: int -> xsymbol
  val nonterminal: int -> xsymbol

  (* The left-hand side of every production. (Same as in [TableFormat.TABLES].) *)

  val lhs: PackedIntArray.t

  (* The right-hand side of every production. This a linearized array
     of arrays of integers, whose [data] and [entry] components have
     been packed. The encoding of symbols as integers in described in
     [TableBackend]. *)

  val rhs: PackedIntArray.t * PackedIntArray.t

  (* A mapping of every (non-initial) state to its LR(0) core. *)

  val lr0_core: PackedIntArray.t

  (* A mapping of every LR(0) state to its set of LR(0) items. Each item is
     represented in its packed form (see [Item]) as an integer. Thus the
     mapping is an array of arrays of integers, which is linearized and
     packed, like [rhs]. *)

  val lr0_items: PackedIntArray.t * PackedIntArray.t

46 47 48 49
  (* A mapping of every LR(0) state to its incoming symbol, if it has one. *)

  val lr0_incoming: PackedIntArray.t

50 51 52
  (* A table that tells which non-terminal symbols are nullable. *)

  val nullable: string
POTTIER Francois's avatar
POTTIER Francois committed
53 54
    (* This is a packed int array of bit width 1. It can be read
       using [PackedIntArray.get1]. *)
55

56 57
end