rustlr 0.4.1

LR Parser Generator with Advanced Options
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
//Abstract syntax types generated by rustlr for grammar pascal
    
#![allow(unused_variables)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(dead_code)]
extern crate rustlr;
use rustlr::LBox;

#[derive(Debug)]
pub enum fixed_part {
  fixed_part_51(LBox<record_section>),
  fixed_part_50(LBox<fixed_part>,LBox<record_section>),
  fixed_part_Nothing,
}
impl Default for fixed_part { fn default()->Self { fixed_part::fixed_part_Nothing } }

#[derive(Debug)]
pub enum factor {
  factor_153(LBox<variable>),
  TERMINAL2_155(LBox<expression>),
  factor_156(LBox<set>),
  factor_154(unsigned_lit),
  factor_Nothing,
}
impl Default for factor { fn default()->Self { factor::factor_Nothing } }

#[derive(Debug)]
pub enum external_files {
  external_files_1,
  TERMINAL2_2(newident_list),
  external_files_Nothing,
}
impl Default for external_files { fn default()->Self { external_files::external_files_Nothing } }

#[derive(Debug)]
pub enum function_form {
  function_form_74(LBox<formal_params>,ident),
  function_form_73,
  function_form_Nothing,
}
impl Default for function_form { fn default()->Self { function_form::function_form_Nothing } }

#[derive(Debug)]
pub enum type {
  type_34(simple_type),
  type_36(LBox<struct_type>),
  TERMINAL12_37,
  PACKED_35(LBox<struct_type>),
  type_Nothing,
}
impl Default for type { fn default()->Self { type::type_Nothing } }

#[derive(Debug)]
pub enum expression {
  expression_131(LBox<simple_expr>,relational_op,LBox<simple_expr>),
  expression_130(LBox<simple_expr>),
  expression_Nothing,
}
impl Default for expression { fn default()->Self { expression::expression_Nothing } }

#[derive(Debug)]
pub enum record_section {
  record_section_52(newident_list,LBox<type>),
  record_section_53,
  record_section_Nothing,
}
impl Default for record_section { fn default()->Self { record_section::record_section_Nothing } }

#[derive(Debug)]
pub enum formal_p_sects {
  formal_p_sects_79(LBox<formal_p_sects>,LBox<formal_p_sect>),
  formal_p_sects_80(LBox<formal_p_sect>),
  formal_p_sects_Nothing,
}
impl Default for formal_p_sects { fn default()->Self { formal_p_sects::formal_p_sects_Nothing } }

#[derive(Debug)]
pub enum statement {
  IF_103(expression,LBox<statement>,LBox<statement>),
  CASE_104(expression,LBox<case_list>),
  statement_96,
  GOTO_101(label),
  REPEAT_106(LBox<statements>,expression),
  statement_100(procedure_call),
  WHILE_105(expression,LBox<statement>),
  FOR_107(ident,expression,direction,expression,LBox<statement>),
  WITH_108(rec_var_list,LBox<statement>),
  statement_99(assignment),
  IF_102(expression,LBox<statement>),
  statement_98(LBox<compound_stmt>),
  statement_97(label,LBox<statement>),
  statement_Nothing,
}
impl Default for statement { fn default()->Self { statement::statement_Nothing } }

#[derive(Debug)]
pub enum opt_declarations {
  opt_declarations_4,
  opt_declarations_5(LBox<declarations>),
  opt_declarations_Nothing,
}
impl Default for opt_declarations { fn default()->Self { opt_declarations::opt_declarations_Nothing } }

#[derive(Debug)]
pub enum case_list_elem {
  case_list_elem_124,
  case_list_elem_123(case_label_list,LBox<statement>),
  case_list_elem_Nothing,
}
impl Default for case_list_elem { fn default()->Self { case_list_elem::case_list_elem_Nothing } }

#[derive(Debug)]
pub enum type_defs {
  type_defs_31(LBox<type_defs>,type_def),
  type_defs_32(type_def),
  type_defs_Nothing,
}
impl Default for type_defs { fn default()->Self { type_defs::type_defs_Nothing } }

#[derive(Debug)]
pub enum formal_params {
  TERMINAL2_78(LBox<formal_p_sects>),
  formal_params_77,
  formal_params_Nothing,
}
impl Default for formal_params { fn default()->Self { formal_params::formal_params_Nothing } }

#[derive(Debug)]
pub enum simple_expr {
  TERMINAL14_141(LBox<term>),
  simple_expr_142(LBox<simple_expr>,add_op,LBox<term>),
  simple_expr_139(LBox<term>),
  TERMINAL8_140(LBox<term>),
  simple_expr_Nothing,
}
impl Default for simple_expr { fn default()->Self { simple_expr::simple_expr_Nothing } }

#[derive(Debug)]
pub enum unsigned_lit {
  STRING,
  NIL,
  unsigned_lit_158(unsigned_num),
  unsigned_lit_Nothing,
}
impl Default for unsigned_lit { fn default()->Self { unsigned_lit::unsigned_lit_Nothing } }

#[derive(Debug)]
pub enum expressions {
  expressions_173(LBox<expression>),
  expressions_172(LBox<expressions>,LBox<expression>),
  expressions_Nothing,
}
impl Default for expressions { fn default()->Self { expressions::expressions_Nothing } }

#[derive(Debug)]
pub enum variable_dcls {
  variable_dcls_62(LBox<variable_dcls>,variable_dcl),
  variable_dcls_63(variable_dcl),
  variable_dcls_Nothing,
}
impl Default for variable_dcls { fn default()->Self { variable_dcls::variable_dcls_Nothing } }

#[derive(Debug)]
pub enum statements {
  statements_94(LBox<statements>,LBox<statement>),
  statements_95(LBox<statement>),
  statements_Nothing,
}
impl Default for statements { fn default()->Self { statements::statements_Nothing } }

#[derive(Debug)]
pub enum declaration {
  declaration_8(label_dcl_part),
  declaration_11(var_dcl_part),
  declaration_12(LBox<proc_dcl_part>),
  declaration_10(type_dcl_part),
  declaration_9(const_dcl_part),
  declaration_Nothing,
}
impl Default for declaration { fn default()->Self { declaration::declaration_Nothing } }

#[derive(Debug)]
pub enum struct_type {
  SET_43(simple_type),
  RECORD_42(LBox<field_list>),
  ARRAY_41(index_t_list,LBox<type>),
  SFILE_44(LBox<type>),
  struct_type_Nothing,
}
impl Default for struct_type { fn default()->Self { struct_type::struct_type_Nothing } }

#[derive(Debug)]
pub enum tag_field {
  tag_field_56(ident),
  tag_field_55(newident,ident),
  tag_field_Nothing,
}
impl Default for tag_field { fn default()->Self { tag_field::tag_field_Nothing } }

#[derive(Debug)]
pub enum const_defs {
  const_defs_19(const_def),
  const_defs_18(LBox<const_defs>,const_def),
  const_defs_Nothing,
}
impl Default for const_defs { fn default()->Self { const_defs::const_defs_Nothing } }

#[derive(Debug)]
pub enum unsigned_num {
  UNSIGNED_INT,
  UNSIGNED_REAL,
  unsigned_num_Nothing,
}
impl Default for unsigned_num { fn default()->Self { unsigned_num::unsigned_num_Nothing } }

#[derive(Debug)]
pub enum proc_or_func {
  proc_or_func_70(func_heading,LBox<body>),
  proc_or_func_69(proc_heading,LBox<body>),
  proc_or_func_Nothing,
}
impl Default for proc_or_func { fn default()->Self { proc_or_func::proc_or_func_Nothing } }

#[derive(Debug)]
pub enum actual_params {
  actual_params_113,
  TERMINAL2_114(LBox<actuals_list>),
  actual_params_Nothing,
}
impl Default for actual_params { fn default()->Self { actual_params::actual_params_Nothing } }

#[derive(Debug)]
pub enum labels {
  labels_15(label),
  labels_14(LBox<labels>,label),
  labels_Nothing,
}
impl Default for labels { fn default()->Self { labels::labels_Nothing } }

#[derive(Debug)]
pub enum index_specs {
  index_specs_90(index_spec),
  index_specs_89(LBox<index_specs>,index_spec),
  index_specs_Nothing,
}
impl Default for index_specs { fn default()->Self { index_specs::index_specs_Nothing } }

#[derive(Debug)]
pub enum add_op {
  TERMINAL14,
  OR,
  TERMINAL8,
  add_op_Nothing,
}
impl Default for add_op { fn default()->Self { add_op::add_op_Nothing } }

#[derive(Debug)]
pub enum declarations {
  declarations_6(LBox<declarations>,LBox<declaration>),
  declarations_7(LBox<declaration>),
  declarations_Nothing,
}
impl Default for declarations { fn default()->Self { declarations::declarations_Nothing } }

#[derive(Debug)]
pub enum formal_p_sect {
  formal_p_sect_81(param_group),
  formal_p_sect_84(LBox<func_heading>),
  formal_p_sect_83(LBox<proc_heading>),
  VAR_82(param_group),
  formal_p_sect_Nothing,
}
impl Default for formal_p_sect { fn default()->Self { formal_p_sect::formal_p_sect_Nothing } }

#[derive(Debug)]
pub enum variable {
  variable_168(ident,LBox<actual_params>),
  variable_170(LBox<variable>,ident),
  variable_169(LBox<variable>,LBox<expressions>),
  variable_Nothing,
}
impl Default for variable { fn default()->Self { variable::variable_Nothing } }

#[derive(Debug)]
pub enum paramtype {
  ARRAY_87(index_specs,LBox<paramtype>),
  PACKED_88(index_spec,ident),
  paramtype_86(ident),
  paramtype_Nothing,
}
impl Default for paramtype { fn default()->Self { paramtype::paramtype_Nothing } }

#[derive(Debug)]
pub enum case_list {
  case_list_122(LBox<case_list_elem>),
  case_list_121(LBox<case_list>,LBox<case_list_elem>),
  case_list_Nothing,
}
impl Default for case_list { fn default()->Self { case_list::case_list_Nothing } }

#[derive(Debug)]
pub enum new_id_list {
  new_id_list_66(LBox<new_id_list>,newident),
  new_id_list_67(newident),
  new_id_list_Nothing,
}
impl Default for new_id_list { fn default()->Self { new_id_list::new_id_list_Nothing } }

#[derive(Debug)]
pub enum case_label_list {
  case_label_list_126(case_label),
  case_label_list_125(LBox<case_label_list>,case_label),
  case_label_list_Nothing,
}
impl Default for case_label_list { fn default()->Self { case_label_list::case_label_list_Nothing } }

#[derive(Debug)]
pub enum rec_var_list {
  rec_var_list_129(record_var),
  rec_var_list_128(LBox<rec_var_list>,record_var),
  rec_var_list_Nothing,
}
impl Default for rec_var_list { fn default()->Self { rec_var_list::rec_var_list_Nothing } }

#[derive(Debug)]
pub enum direction {
  TO,
  DOWNTO,
  direction_Nothing,
}
impl Default for direction { fn default()->Self { direction::direction_Nothing } }

#[derive(Debug)]
pub enum field_list {
  field_list_47(LBox<fixed_part>),
  field_list_48(LBox<fixed_part>,LBox<variant_part>),
  field_list_49(LBox<variant_part>),
  field_list_Nothing,
}
impl Default for field_list { fn default()->Self { field_list::field_list_Nothing } }

#[derive(Debug)]
pub enum member_list {
  member_list_163(LBox<members>),
  member_list_162,
  member_list_Nothing,
}
impl Default for member_list { fn default()->Self { member_list::member_list_Nothing } }

#[derive(Debug)]
pub enum actual_param {
  actual_param_117(LBox<expression>),
  actual_param_118(LBox<expression>,LBox<colon_things>),
  actual_param_Nothing,
}
impl Default for actual_param { fn default()->Self { actual_param::actual_param_Nothing } }

#[derive(Debug)]
pub enum mult_op {
  DIV,
  TERMINAL5,
  AND,
  TERMINAL9,
  MOD,
  mult_op_Nothing,
}
impl Default for mult_op { fn default()->Self { mult_op::mult_op_Nothing } }

#[derive(Debug)]
pub enum members {
  members_165(LBox<member>),
  members_164(LBox<members>,LBox<member>),
  members_Nothing,
}
impl Default for members { fn default()->Self { members::members_Nothing } }

#[derive(Debug)]
pub enum variant {
  variant_59(case_label_list,LBox<field_list>),
  variant_60,
  variant_Nothing,
}
impl Default for variant { fn default()->Self { variant::variant_Nothing } }

#[derive(Debug)]
pub enum actuals_list {
  actuals_list_115(LBox<actuals_list>,LBox<actual_param>),
  actuals_list_116(LBox<actual_param>),
  actuals_list_Nothing,
}
impl Default for actuals_list { fn default()->Self { actuals_list::actuals_list_Nothing } }

#[derive(Debug)]
pub enum member {
  member_166(LBox<expression>),
  member_167(LBox<expression>,LBox<expression>),
  member_Nothing,
}
impl Default for member { fn default()->Self { member::member_Nothing } }

#[derive(Debug)]
pub enum relational_op {
  IN,
  GE,
  TERMINAL13,
  TERMINAL15,
  TERMINAL3,
  LE,
  NE,
  relational_op_Nothing,
}
impl Default for relational_op { fn default()->Self { relational_op::relational_op_Nothing } }

#[derive(Debug)]
pub enum variants {
  variants_57(LBox<variants>,LBox<variant>),
  variants_58(LBox<variant>),
  variants_Nothing,
}
impl Default for variants { fn default()->Self { variants::variants_Nothing } }

#[derive(Debug)]
pub enum colon_things {
  TERMINAL0_119(LBox<expression>),
  TERMINAL0_120(LBox<expression>,LBox<expression>),
  colon_things_Nothing,
}
impl Default for colon_things { fn default()->Self { colon_things::colon_things_Nothing } }

#[derive(Debug)]
pub enum body {
  body_75(LBox<block>),
  IDENTIFIER,
  body_Nothing,
}
impl Default for body { fn default()->Self { body::body_Nothing } }

#[derive(Debug)]
pub enum index_t_list {
  index_t_list_45(LBox<index_t_list>,simple_type),
  index_t_list_46(simple_type),
  index_t_list_Nothing,
}
impl Default for index_t_list { fn default()->Self { index_t_list::index_t_list_Nothing } }

#[derive(Debug)]
pub enum simple_type {
  simple_type_40(ident),
  simple_type_39(constant,constant),
  TERMINAL2_38(newident_list),
  simple_type_Nothing,
}
impl Default for simple_type { fn default()->Self { simple_type::simple_type_Nothing } }

#[derive(Debug)]
pub enum term {
  term_147(LBox<term>,mult_op,LBox<factor>),
  term_146(LBox<factor>),
  term_Nothing,
}
impl Default for term { fn default()->Self { term::term_Nothing } }

#[derive(Debug)]
pub enum constant {
  constant_21(unsigned_num),
  STRING,
  TERMINAL8_22(unsigned_num),
  TERMINAL8_25(ident),
  constant_24(ident),
  TERMINAL14_26(ident),
  TERMINAL14_23(unsigned_num),
  constant_Nothing,
}
impl Default for constant { fn default()->Self { constant::constant_Nothing } }

#[derive(Default,Debug)]
pub struct variant_part(pub tag_field,pub LBox<variants>,);

#[derive(Default,Debug)]
pub struct variable_dcl(pub newident_list,pub type,);

#[derive(Default,Debug)]
pub struct statement_part(pub compound_stmt,);

#[derive(Default,Debug)]
pub struct proc_heading(pub newident,pub LBox<formal_params>,);

#[derive(Default,Debug)]
pub struct block(pub LBox<opt_declarations>,pub statement_part,);

#[derive(Default,Debug)]
pub struct procedure_call(pub ident,pub actual_params,);

#[derive(Default,Debug)]
pub struct param_group(pub newident_list,pub paramtype,);

#[derive(Default,Debug)]
pub struct label();

#[derive(Default,Debug)]
pub struct label_dcl_part(pub labels,);

#[derive(Default,Debug)]
pub struct func_heading(pub newident,pub LBox<function_form>,);

#[derive(Default,Debug)]
pub struct var_dcl_part(pub variable_dcls,);

#[derive(Default,Debug)]
pub struct ident();

#[derive(Default,Debug)]
pub struct program(pub newident,pub external_files,pub block,);

#[derive(Default,Debug)]
pub struct const_def(pub newident,pub constant,);

#[derive(Default,Debug)]
pub struct index_spec(pub newident,pub newident,pub ident,);

#[derive(Default,Debug)]
pub struct newident_list(pub new_id_list,);

#[derive(Default,Debug)]
pub struct type_def(pub newident,pub type,);

#[derive(Default,Debug)]
pub struct assignment(pub variable,pub expression,);

#[derive(Default,Debug)]
pub struct set(pub LBox<member_list>,);

#[derive(Default,Debug)]
pub struct compound_stmt(pub LBox<statements>,);

#[derive(Default,Debug)]
pub struct proc_dcl_part(pub LBox<proc_or_func>,);

#[derive(Default,Debug)]
pub struct case_label(pub constant,);

#[derive(Default,Debug)]
pub struct const_dcl_part(pub const_defs,);

#[derive(Default,Debug)]
pub struct newident();

#[derive(Default,Debug)]
pub struct record_var(pub variable,);

#[derive(Default,Debug)]
pub struct type_dcl_part(pub type_defs,);