-
Notifications
You must be signed in to change notification settings - Fork 0
/
grammar.txt
94 lines (94 loc) · 2.69 KB
/
grammar.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
program moduleDeclarations otherModules driverModule otherModules
moduleDeclarations moduleDeclaration moduleDeclarations
moduleDeclarations e
moduleDeclaration DECLARE MODULE ID SEMICOL
otherModules module otherModules
otherModules e
driverModule DRIVERDEF DRIVER PROGRAM DRIVERENDDEF moduleDef
module DEF MODULE ID ENDDEF TAKES INPUT SQBO input_plist SQBC SEMICOL ret moduleDef
ret RETURNS SQBO output_plist SQBC SEMICOL
ret e
input_plist ID COLON dataType input_plist2
input_plist2 COMMA ID COLON dataType input_plist2
input_plist2 e
output_plist ID COLON type output_plist2
output_plist2 COMMA ID COLON type output_plist2
output_plist2 e
dataType INTEGER
dataType REAL
dataType BOOLEAN
dataType ARRAY SQBO range SQBC OF type
type INTEGER
type REAL
type BOOLEAN
moduleDef START statements END
statements statement statements
statements e
statement ioStmt
statement simpleStmt
statement declareStmt
statement conditionalStmt
statement iterativeStmt
ioStmt GET_VALUE BO ID BC SEMICOL
ioStmt PRINT BO var BC SEMICOL
var ID whichId
var NUM
var RNUM
whichId SQBO ID SQBC
whichId e
simpleStmt assignmentStmt
simpleStmt moduleReuseStmt
assignmentStmt ID whichStmt
whichStmt lvalueIDStmt
whichStmt lvalueARRStmt
lvalueIDStmt ASSIGNOP expression SEMICOL
lvalueARRStmt SQBO index1 SQBC ASSIGNOP expression SEMICOL
index1 NUM
index1 ID
moduleReuseStmt optional USE MODULE ID WITH PARAMETERS idList SEMICOL
optional SQBO idList SQBC ASSIGNOP
optional e
idList ID idList2
idList2 COMMA ID idList2
idList2 e
expression arithmeticOrBooleanExpr
expression MINUS BO arithmeticExpr BC
arithmeticOrBooleanExpr anyTerm arithmeticOrBooleanExpr2
arithmeticOrBooleanExpr BO arithmeticOrBooleanExpr BC
arithmeticOrBooleanExpr2 logicalOp anyTerm arithmeticOrBooleanExpr2
arithmeticOrBooleanExpr2 e
anyTerm arithmeticExpr anyTerm2
anyTerm2 relationalOp arithmeticExpr anyTerm2
anyTerm2 e
arithmeticExpr term arithmeticExpr2
arithmeticExpr2 op1 term arithmeticExpr2
arithmeticExpr2 e
term factor term2
term2 op2 factor term2
term2 e
factor var
op1 PLUS
op1 MINUS
op2 MUL
op2 DIV
logicalOp AND
logicalOp OR
relationalOp LT
relationalOp LE
relationalOp GT
relationalOp GE
relationalOp EQ
relationalOp NE
declareStmt DECLARE idList COLON dataType SEMICOL
conditionalStmt SWITCH BO ID BC START caseStmts default1 END
caseStmts CASE value COLON statements BREAK SEMICOL caseStmt
caseStmt CASE value COLON statements BREAK SEMICOL caseStmt
caseStmt e
value NUM
value TRUE
value FALSE
default1 DEFAULT COLON statements BREAK SEMICOL
default1 e
iterativeStmt FOR BO ID IN range BC START statements END
iterativeStmt WHILE BO arithmeticOrBooleanExpr BC START statements END
range NUM RANGEOP NUM