Coccinelle release 1.0.0-rc13
[bpt/coccinelle.git] / bundles / menhirLib / menhir-20120123 / src / unparameterizedSyntax.mli
1 (**************************************************************************)
2 (* *)
3 (* Menhir *)
4 (* *)
5 (* François Pottier, INRIA Rocquencourt *)
6 (* Yann Régis-Gianas, PPS, Université Paris Diderot *)
7 (* *)
8 (* Copyright 2005-2008 Institut National de Recherche en Informatique *)
9 (* et en Automatique. All rights reserved. This file is distributed *)
10 (* under the terms of the Q Public License version 1.0, with the change *)
11 (* described in file LICENSE. *)
12 (* *)
13 (**************************************************************************)
14
15 (* A parameterized branch may instantiate parameterized non terminals.
16 If the parameterized branch contributes to the definition of a
17 parameterized terminal, then the instantiation of parameterized
18 non terminals that are defined simultaneously must only be done with
19 formal parameters.
20 Furthermore, all the parameterized non terminals that are in a common
21 mutual recursive definition must have the same arity.
22 These conditions are sufficient to ensure termination of expansion.
23 For example:
24 C[x] : ... // This definition does not involve A or B.
25 A[x,y] : B[x,y] C[Y] // This mutual recursive definition is ok.
26 B[x,y] : A[x,y]
27 D[x] : E[D[x]] // This one is incorrect.
28 E[y] : D[y]
29 *)
30 open Syntax
31
32 type branch =
33 {
34 branch_position : Positions.t;
35 producers : (symbol * identifier option) list; (* TEMPORARY convention renversée
36 par rapport à syntax.mli; faire un type record au lieu d'une paire? *)
37 action : action;
38 branch_shift_precedence : branch_shift_precedence;
39 branch_reduce_precedence : branch_reduce_precedence
40 }
41
42 type rule =
43 {
44 branches : branch list;
45 positions : Positions.t list;
46 (* This flag is not relevant after the NonTerminalInlining.inline pass. *)
47 inline_flag : bool;
48 }
49
50 type grammar =
51 {
52 preludes : Stretch.t list;
53 postludes : Syntax.trailer list;
54 parameters : Stretch.t list;
55 start_symbols : StringSet.t;
56 types : Stretch.ocamltype StringMap.t;
57 tokens : Syntax.token_properties StringMap.t;
58 rules : rule StringMap.t;
59 }