-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGrammar.txt
59 lines (59 loc) · 2.32 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
<programStart> --> PROGRAM RBO RBC CYBO <declarations> <assignments> CYBC
<declarations> --> <declaration> <declarations>
<declarations> --> <declaration>
<declaration> --> DECLARE ID COLON <primDatatype> SEMICOLON
<declaration> --> DECLARE ID COLON <arrDatatype> SEMICOLON
<declaration> --> DECLARE ID COLON <jarrDatatype> SEMICOLON <jaggedInit>
<declaration> --> <commonList> <primDatatype> SEMICOLON
<declaration> --> <commonList> <arrDatatype> SEMICOLON
<declaration> --> <commonList> <jarrDatatype> SEMICOLON <jaggedInit>
<commonList> --> DECLARE LIST OF VARIABLES <IDList> COLON
<IDList> --> ID ID <extendIDList>
<extendIDList> --> ID <extendIDList>
<extendIDList> --> #
<primDatatype> --> INTEGER
<primDatatype> --> REAL
<primDatatype> --> BOOLEAN
<arrDatatype> --> ARRAY <arrayDims> OF INTEGER
<arrayDims> --> SQBO <IDNum> ELLIPSIS <IDNum> SQBC <arrayDims>
<arrayDims> --> SQBO <IDNum> ELLIPSIS <IDNum> SQBC
<IDNum> --> ID
<IDNum> --> NUM
<jarrDatatype> --> JAGGED ARRAY SQBO NUM ELLIPSIS NUM SQBC SQBO SQBC <option3D> OF INTEGER
<option3D> --> SQBO SQBC
<option3D> --> #
<jaggedInit> --> R1 SQBO NUM SQBC COLON SIZE NUM COLON VALUES CYBO <jaggedValues> CYBC <jaggedInit>
<jaggedInit> --> R1 SQBO NUM SQBC COLON SIZE NUM COLON VALUES CYBO <jaggedValues> CYBC
<jaggedValues> --> <numList> SEMICOLON <jaggedValues>
<jaggedValues> --> <numList>
<jaggedValues> --> SEMICOLON <jaggedValues>
<jaggedValues> --> #
<numList> --> NUM <numList>
<numList> --> NUM
<assignments> --> <assignment> <assignments>
<assignments> --> <assignment>
<assignment> --> ID <leftHandSide>
<leftHandSide> --> <lvalueID>
<leftHandSide> --> <lvalueArr>
<lvalueID> --> ASSIGNOP <expression> SEMICOLON
<lvalueArr> --> SQBO <indices> SQBC ASSIGNOP <expression> SEMICOLON
<indices> --> <IDNum> <indices>
<indices> --> <IDNum>
<expression> --> <arithmeticExpr> <booleanExpr>
<booleanExpr> --> <logicalOp> <arithmeticExpr> <booleanExpr>
<booleanExpr> --> #
<arithmeticExpr> --> <term> <extendArithmeticExpr>
<extendArithmeticExpr> --> <opPlusMinus> <term> <extendArithmeticExpr>
<extendArithmeticExpr> --> #
<term> --> <factor> <extendTerm>
<extendTerm> --> <opMuLDiv> <factor> <extendTerm>
<extendTerm> --> #
<factor> --> ID SQBO <indices> SQBC
<factor> --> ID
<factor> --> NUM
<opPlusMinus> --> PLUS
<opPlusMinus> --> MINUS
<opMuLDiv> --> MUL
<opMuLDiv> --> DIV
<logicalOp> --> AND
<logicalOp> --> OR