2 and_ | as_ | in_ | datatype_ | type_ | where_ | view_ | public_ | private_ | protected_
3 | id_ | functor_ | let_ | defrule_ | if_ | assert_ | retract_ | left_arrow_
4 | colon_dash_ | defclause_ | lexscan_ | lexscanner_ | tokentype_
5 | and_colon_ | or_colon_ | not_colon_ | implies_colon_ | equiv_colon_ | xor_colon_
6 | character_ | integer_ | real_ | string_ | regexp_
7 | and_also_ | or_else_ | left_shift_ | right_shift_
8 | inc_ | dec_ | ge_ | le_ | eq_ | ne_ | dots_
9 | match_ | matchall_ | rewrite_ | reduce_ | case_ | operator_
10 | class_ | struct_ | union_ | exp_
11 | plus_eq_ | minus_eq_ | mult_eq_ | div_eq_ | mod_eq_
12 | or_eq_ | and_eq_ | xor_eq_ | left_shift_eq_ | right_shift_eq_
13 | arrow_ | colon_colon_ | int_ | instantiate_ | error_colon_ | eof_colon_
14 | before_colon_ | case_insensitive_colon_ | non_backtracking_colon_
15 | contexts_colon_ | lalr1_parse_ | lalr1_parser_
22 %left left_shift_ right_shift_
30 %right '=' plus_eq_ minus_eq_ mult_eq_ div_eq_ mod_eq_
31 %right or_eq_ and_eq_ xor_eq_ left_shift_eq_ right_shift_eq_
40 syntax class BigOne {};
43 /***************************************************************************
45 ***************************************************************************/
48 /***************************************************************************
50 ***************************************************************************/
55 /***************************************************************************
56 * Declarations can be either datatype or type declarations, pattern
57 * matching or rewriting statements
58 ***************************************************************************/
62 datatype_decl_list where_types ';'
64 datatype_decl_list where_types ';'
65 | instantiate_datatype_decl
66 | typep type_decl_list ';'
79 token_type: tokentype_
86 /***************************************************************************
88 ***************************************************************************/
89 parse_decl: lalr1_parse paren_exp '{' parse_rule_list '}'
93 lalr1_parse: lalr1_parse_
97 | parse_rule parse_rule_list
101 parse_rule: id ':' parse_production_list
106 parse_production_list: parse_production
108 | parse_production '|' parse_production_list
112 parse_production: parse_symbol_list
116 | parse_symbol parse_symbol_list
134 /***************************************************************************
135 * Lexical scanner generator
136 ***************************************************************************/
138 lexscan_decl: lexscan_tok paren_exp lex_dummy
139 '{' case_insensitive_opt non_backtracking_opt contexts_opt
140 before_opt lexscan_rules '}'
143 contexts_opt: contexts_colon_ id
147 non_backtracking_opt: non_backtracking_colon_
151 case_insensitive_opt: case_insensitive_colon_
164 lexscan_tok: lexscan_
167 lexscan_rules: lexscan_rule
169 | lexscan_rule lexscan_rules
173 lexscan_rule: casep string_or_wild_card ':'
181 string_or_wild_card: string
185 /***************************************************************************
186 * Instantiate a datatype
187 ***************************************************************************/
188 instantiate_datatype_decl: instantiatep datatype_ instantiate_ty_decl_list ';'
192 instantiate_ty_decl_list:
195 | instantiate_ty_decl ',' instantiate_ty_decl_list
202 | id '<' ty_or_int_list '>'
206 instantiatep: instantiate_
209 /***************************************************************************
211 ***************************************************************************/
212 reduce_decl: reduce paren_exp '{' reduction_rules '}'
221 /***************************************************************************
223 ***************************************************************************/
224 rewrite_decl: rewrite_tok '(' exp ')' '{' body '}'
227 rewrite_tok: rewrite_
230 /***************************************************************************
231 * Datatype declaration list contains a list of mutually recursive
232 * datatype declarations.
233 ***************************************************************************/
234 datatype_decl_list: datatype_decl
236 | datatype_decl and_ datatype_decl_list
240 /***************************************************************************
241 * An optional list of type declarations may follow datatype declarations
242 ***************************************************************************/
244 | where_ type_ type_decl_list
247 /***************************************************************************
249 ***************************************************************************/
250 type_decl_list: type_decl
251 | type_decl and_ type_decl_list
254 /***************************************************************************
255 * Type declarations may be used in place of typedef's
256 ***************************************************************************/
259 | id '<' template_var_list '>' '=' ty
263 /***************************************************************************
264 * A datatype declaration defines the name of the type (which may be
265 * parametric) followed a list of term declarations.
266 ***************************************************************************/
267 datatype_decl: id scope_opt '=' term_decl_list
270 | id '<' template_var_list '>' scope_opt '=' term_decl_list
291 view_aliases: view_alias
292 | view_alias '|' view_aliases
295 view_alias: term_decl ':' pat
307 /***************************************************************************
308 * Termplate variable list
309 ***************************************************************************/
310 template_var_list: template_var
311 | template_var ',' template_var_list
315 /***************************************************************************
316 * A template variable may be parameterized by type or by an integer
317 ***************************************************************************/
318 template_var: class_ id
323 /***************************************************************************
325 ***************************************************************************/
326 horn_clause_decl: defclause_tok horn_clause_list '.'
329 defclause_tok: defclause_
332 horn_clause_list: horn_clause
333 | horn_clause and_ horn_clause_list
337 | clause colon_dash_ clause_list
344 | clause ',' clause_list
348 /***************************************************************************
352 ***************************************************************************/
363 let_exp_list: let_exp
364 | let_exp and_ let_exp_list
367 let_exp: pat '=' paren_exp
371 match_decl: match_tok match_exp_list
377 matchall_decl: matchall_tok match_exp_list
385 matchall_tok: matchall_
388 match_exp_list: paren_exp
389 | paren_exp and_ match_exp_list
410 production_decl: defrule_ production_rule_list ';'
414 production_rule_list:
415 | production_rule production_rule_list
419 production_rule: rule_name
429 antecedent_list: antecedent
431 | antecedent ',' antecedent_list
435 antecedent: id paren_exp
461 | '`' '[' pat_list dots_opt ']'
462 | '{' lab_pat_list '}'
463 | '(' simple_pat binop_pat pat ')'
464 | '(' prefixop simple_pat ')'
465 | '(' simple_pat postfixop ')'
478 | pat implies_colon_ pat
479 | pat equiv_colon_ pat
481 | not_colon_ simple_pat
488 lab_pat_list2: lab_pat
489 | lab_pat ',' lab_pat_list2
501 pat_list2: pat ',' pat
506 class_ty: class_ class_ty
508 | id '<' ty_or_int_list '>'
514 | '{' lab_ty_list '}'
527 | lab_ty ',' lab_ty_list
537 | id '{' lab_ty_list '}'
544 term_decl_list: term_decl
545 | term_decl '|' term_decl_list
558 | operator_ postfixop
604 ty_or_int_list: ty_or_int
606 | ty_or_int ',' ty_or_int_list
620 character: character_