forked from RobertHarper/cmyacc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparsemain.cmyacc
64 lines (52 loc) · 1.58 KB
/
parsemain.cmyacc
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
name ParseMainFun
terminal IDENT of string
terminal NUMBER of int
terminal ARROW
terminal COLON
terminal EQUAL
terminal FOLLOWER
terminal NAME
terminal NONTERMINAL
terminal NOPREC
terminal LPAREN
terminal OF
terminal PRECL
terminal PRECR
terminal RPAREN
terminal START
terminal TERMINAL
nonterminal Ident : symbol =
1:IDENT => sole_ident
nonterminal Number : int =
1:NUMBER => sole_number
nonterminal Label : label =
1:Ident => ident_label
1:Number => number_label
nonterminal Constituent : constituent =
1:Ident => unlabeled_item
1:Label COLON 2:Ident => labeled_item
LPAREN 1:Constituent RPAREN => paren_item
nonterminal Constituents : constituents =
=> nil_constituents
1:Constituent 2:Constituents => cons_constituents
nonterminal Precedence : precedence =
=> empty_precedence
PRECL 1:Number => left_precedence
PRECR 1:Number => right_precedence
NOPREC => no_precedence
nonterminal Production : production =
1:Constituents ARROW 2:Ident 3:Precedence => sole_production
nonterminal Productions : productions =
=> nil_productions
1:Production 2:Productions => cons_productions
nonterminal Directive : directive =
NAME 1:IDENT => name_directive
TERMINAL 1:Ident 2:Precedence => terminal_directive
TERMINAL 1:Ident OF 2:Ident 3:Precedence => terminal_of_directive
NONTERMINAL 1:Ident COLON 2:Ident EQUAL 3:Productions => nonterminal_directive
START 1:Ident => start_directive
FOLLOWER 1:Ident => follower_directive
nonterminal Directives : directives =
=> nil_directives
1:Directive 2:Directives => cons_directives
start Directives