-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsplitedGrammer.txt
104 lines (104 loc) · 2.48 KB
/
splitedGrammer.txt
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
Program -> ProgramHead DeclarePart ProgramBody .
ProgramHead -> PROGRAM ProgramName
ProgramName -> ID
DeclarePart -> TypeDec VarDec ProcDec
TypeDec -> ε
TypeDec -> TypeDeclaration
TypeDeclaration -> TYPE TypeDecList
TypeDecList -> TypeId = TypeName ; TypeDecMore
TypeDecMore -> ε
TypeDecMore -> TypeDecList
TypeId -> ID
TypeName -> BaseType
TypeName -> StructureType
TypeName -> ID
BaseType -> INTEGER
BaseType -> CHAR
StructureType -> ArrayType
StructureType -> RecType
ArrayType -> ARRAY [ Low .. Top ] OF BaseType
Low -> INTC
Top -> INTC
RecType -> RECORD FieldDecList END
FieldDecList -> BaseType IdList ; FieldDecMore
FieldDecList -> ArrayType IdList ; FieldDecMore
FieldDecMore -> ε
FieldDecMore -> FieldDecList
IdList -> ID IdMore
IdMore -> ε
IdMore -> , IdList
VarDec -> ε
VarDec -> VarDeclaration
VarDeclaration -> VAR VarDecList
VarDecList -> TypeName VarIdList ; VarDecMore
VarDecMore -> ε
VarDecMore -> VarDecList
VarIdList -> ID VarIdMore
VarIdMore -> ε
VarIdMore -> , VarIdList
ProcDec -> ε
ProcDec -> ProcDeclaration
ProcDeclaration -> PROCEDURE ProcName ( ParamList ) ; ProcDecPart ProcBody ProcDecMore
ProcDecMore -> ε
ProcDecMore -> ProcDeclaration
ProcName -> ID
ParamList -> ε
ParamList -> ParamDecList
ParamDecList -> Param ParamMore
ParamMore -> ε
ParamMore -> ; ParamDecList
Param -> TypeName FormList
Param -> VAR TypeName FormList
FormList -> ID FidMore
FidMore -> ε
FidMore -> , FormList
ProcDecPart -> DeclarePart
ProcBody -> ProgramBody
ProgramBody -> BEGIN StmList END
StmList -> Stm StmMore
StmMore -> ε
StmMore -> ; StmList
Stm -> ConditionalStm
Stm -> LoopStm
Stm -> InputStm
Stm -> OutputStm
Stm -> ReturnStm
Stm -> ID AssCall
AssCall -> AssignmentRest
AssCall -> CallStmRest
AssignmentRest -> VariMore := Exp
ConditionalStm -> IF RelExp THEN StmList ELSE StmList FI
LoopStm -> WHILE RelExp DO StmList ENDWH
InputStm -> READ ( Invar )
Invar -> ID
OutputStm -> WRITE ( Exp )
ReturnStm -> RETURN ( Exp )
CallStmRest -> ( ActParamList )
ActParamList -> ε
ActParamList -> Exp ActParamMore
ActParamMore -> ε
ActParamMore -> , ActParamList
RelExp -> Exp OtherRelE
OtherRelE -> CmpOp Exp
Exp -> Term OtherTerm
OtherTerm -> ε
OtherTerm -> AddOp Exp
Term -> Factor OtherFactor
OtherFactor -> ε
OtherFactor -> MultOp Term
Factor -> ( Exp )
Factor -> INTC
Factor -> Variable
Variable -> ID VariMore
VariMore -> ε
VariMore -> [ Exp ]
VariMore -> . FieldVar
FieldVar -> ID FieldVarMore
FieldVarMore -> ε
FieldVarMore -> [ Exp ]
CmpOp -> <
CmpOp -> =
AddOp -> +
AddOp -> -
MultOp -> *
MultOp -> /