inspectionTableFormat.ml 2.1 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

  (* 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

24 25
  (* The left-hand side of every production already appears in the
     signature [TableFormat.TABLES], so we need not repeat it here. *)
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44

  (* 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

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

  val lr0_incoming: PackedIntArray.t

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

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

55 56 57 58 59
  (* A two-table dimensional table, indexed by a nonterminal symbol and
     by a terminal symbol (other than [#]), encodes the FIRST sets. *)

  val first: int (* width of the bitmap *) * string (* second component of [PackedIntArray.t] *)

60 61
end