1sig lambdayacc.
2
3
4kind gs type.     % grammar symbol type.
5kind decl type.	  % declaration type for grammar rules.
6type rule decl -> o -> decl.  % rule clause.  The first param. is the
7		      % CFG rule, the second determines attributes.
8type ==> gs -> (list gs) -> decl.   % The |- symbol for grammars
9infixl ==> 10.
10
11type terminal gs -> o.
12type non_terminal gs -> o.
13type start_symbol gs -> o.
14type cfg (list decl) -> o.   % grammar rules
15type getrule decl -> o.
16
17type bofs, eofs, sprime   gs.   % begin and end of file, extra start symbol.
18type id string -> gs.    % universal identifier
19type iconst int -> gs.
20type sconst string -> gs.
21type test int -> gs -> o.
22type ntnum int -> o.
23type first gs -> gs -> o.
24type find_first int -> gs -> gs -> o.
25type before, follow gs -> (list gs) -> o.
26type epsilon gs.
27type first_stage int -> gs -> gs -> o.
28type gen_first out_stream -> int -> o.
29type head (list gs) -> gs -> o.
30type last (list gs) -> gs -> o.
31type look gs -> (list gs) -> gs -> o.
32
33kind ch type.   % candidate handle type
34type handle gs -> decl -> gs -> ch.
35type gen_handles (list ch) -> (list ch) -> (list ch) -> o.
36type context_search gs -> gs -> (list gs) -> (list gs) -> (list gs) -> o.
37type make_handles (list gs) -> (list ch) -> o.
38type rule_to_h gs -> gs -> decl -> ch -> o.
39type getprods gs -> (list decl) -> o.
40type freshcopy gs -> gs -> o.   % avoids instantiating nonterminals!
41type brcvh (list ch) -> o.
42type convert_to_sets ch -> ch -> o.
43
44% added for fbrc:
45type lcontext_search gs -> (list gs) -> (list gs) -> (list gs) -> o.
46type rcontext_search gs -> (list gs) -> (list gs) -> (list gs) -> o.
47type fsbrc (list ch) -> o.
48type fprepare (list decl) -> (list ch) -> o.
49type lgen_shandles (list ch) -> (list ch) -> o.
50type rgen_shandles (list ch) -> (list ch) -> o.
51
52
53%-------------------------  Simple BRC    ---------
54
55type shandle (list gs) -> decl -> (list gs) -> o.
56type shand (list gs) -> decl -> (list gs) -> ch.
57type sbrc (list ch) -> o.
58type sprepare (list decl) -> (list ch) -> o.
59type gen_shandles (list ch) -> (list ch) -> o.
60type make_shandle decl -> ch -> o.
61
62type rrdeterministic (list ch) -> o.
63type srdeterministic (list ch) -> (list ch) -> o.
64type rr_conflict ch -> ch -> o.
65type sr_conflict (list gs) -> (list gs) -> gs -> ch -> o.
66type srprocess (list gs) -> (list gs) -> (list gs) -> (list ch) -> o.
67type genparser_sbrc string -> o.
68type genparser string -> string -> string -> o.
69type gen_reduce out_stream -> ch -> o.
70type gen_shift out_stream -> (list gs) -> (list gs) -> gs -> o.
71type srdecision out_stream -> (list gs) -> gs -> o.
72type decresolve (list gs) -> gs -> o.
73type stream_name out_stream -> o.
74
75
76% signature for generated parser:
77type parse (list gs) -> (list gs) -> gs -> string -> o.
78type binaryop gs -> gs -> gs -> string -> int -> o.  % precedence and type
79type implicitop gs -> gs -> string -> int -> o.      % juxtaposition
80type unaryop gs -> gs -> int -> o.
81
82
83% utilities
84type append (list A) -> (list A) -> (list A) -> o.
85type member A -> (list A) -> o.
86type oncememb A -> (list A) -> o.
87type nth int -> A -> (list A) -> o.
88type length (list A) -> int -> o.
89type reverse (list A) -> (list A) -> o.
90type map1 (A -> B) -> (list A) -> (list B) -> o.
91type map_pred2 (A -> B -> o) -> (list A) -> (list B) -> o.
92type allare (A -> o) -> (list A) -> o.
93type filter (A -> o) -> (list A) -> (list A) -> o.
94type preplace (A -> B -> o) -> A -> B -> (list A) -> (list B) -> o.
95
96% the open-list utility:
97type openlist (list A) -> o.
98type close_list (list A ) -> o.
99type openadd A -> (list A) -> o.
100type openmemb A -> (list A) -> o.
101type opennil A -> o.
102type openmap2 (A -> B -> o) -> (list A) -> (list B) -> o.
103
104
105
106%%%% Tokenizer:
107type printname A -> string -> gs -> o.
108type yyinitial int -> in_stream -> (list gs) -> o.
109type yyalphanum, yyspecial    string -> in_stream -> gs -> o.
110type yycomment in_stream -> o.
111type yystring string -> in_stream -> gs -> o.
112type decdigit, alphab, alphanum, white_space  string -> o.
113type parseline A -> o.
114type parsefile string -> A -> o.
115type yynat string -> in_stream -> gs -> o.
116type natconst int -> gs.  % grammar symbol for natural numbers.
117type parseint string -> int -> o.
118type parseint_aux string -> int -> int -> int -> int -> o.
119type eof_symbol string -> o.
120
121% special grammar symbol to record line numbers.
122% used only to report current line number.
123type linenum int -> gs.
124type finderrline (list gs) -> (list gs) -> o.
125type print_tokens int -> (list gs) -> o.
126
127
128