-
Notifications
You must be signed in to change notification settings - Fork 0
/
rules.txt
87 lines (87 loc) · 4.03 KB
/
rules.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
Rule 0: program --> otherFunctions mainFunction
Rule 1: mainFunction --> TK_MAIN stmts TK_END
Rule 2: otherFunctions -->function otherFunctions
Rule 3: otherFunctions --> eps
Rule 4: function --> TK_FUNID input_par output_par TK_SEM stmts TK_END
Rule 5: input_par --> TK_INPUT TK_PARAMETER TK_LIST TK_SQL parameter_list TK_SQR
Rule 6: output_par --> TK_OUTPUT TK_PARAMETER TK_LIST TK_SQL parameter_list TK_SQR
Rule 7: output_par --> eps
Rule 8: parameter_list -->dataType TK_ID remaining_list
Rule 9: dataType -->primitiveDatatype
Rule 10: dataType -->constructedDatatype
Rule 11: primitiveDatatype --> TK_INT
Rule 12: primitiveDatatype --> TK_REAL
Rule 13: constructedDatatype --> TK_RECORD TK_RECORDID
Rule 14: remaining_list --> TK_COMMA parameter_list
Rule 15: remaining_list --> eps
Rule 16: stmts -->typeDefinitions declarations otherStmts returnStmt
Rule 17: typeDefinitions -->typeDefinition typeDefinitions
Rule 18: typeDefinitions --> eps
Rule 19: typeDefinition --> TK_RECORD TK_RECORDID fieldDefinitions TK_ENDRECORD TK_SEM
Rule 20: fieldDefinitions -->fieldDefinition fieldDefinition moreFields
Rule 21: fieldDefinition --> TK_TYPE primitiveDatatype TK_COLON TK_FIELDID TK_SEM
Rule 22: moreFields -->fieldDefinition moreFields
Rule 23: moreFields --> eps
Rule 24: declarations -->declaration declarations
Rule 25: declarations --> eps
Rule 26: declaration --> TK_TYPE dataType TK_COLON TK_ID global_or_not TK_SEM
Rule 27: global_or_not --> TK_COLON TK_GLOBAL
Rule 28: global_or_not --> eps
Rule 29: otherStmts -->stmt otherStmts
Rule 30: otherStmts --> eps
Rule 31: stmt -->assignmentStmt
Rule 32: stmt -->iterativeStmt
Rule 33: stmt -->conditionalStmt
Rule 34: stmt -->ioStmt
Rule 35: stmt -->funCallStmt
Rule 36: assignmentStmt -->singleOrRecId TK_ASSIGNOP arithmeticExpression TK_SEM
Rule 37: singleOrRecId --> TK_ID new_24
Rule 38: new_24 --> eps
Rule 39: new_24 --> TK_DOT TK_FIELDID
Rule 40: funCallStmt -->outputParameters TK_CALL TK_FUNID TK_WITH TK_PARAMETERS inputParameters TK_SEM
Rule 41: outputParameters --> TK_SQL idList TK_SQR TK_ASSIGNOP
Rule 42: outputParameters --> eps
Rule 43: inputParameters --> TK_SQL idList TK_SQR
Rule 44: iterativeStmt --> TK_WHILE TK_OP booleanExpression TK_CL stmt otherStmts TK_ENDWHILE
Rule 45: conditionalStmt --> TK_IF TK_OP booleanExpression TK_CL TK_THEN stmt otherStmts elsePart
Rule 46: elsePart --> TK_ELSE stmt otherStmts TK_ENDIF
Rule 47: elsePart --> TK_ENDIF
Rule 48: ioStmt --> TK_READ TK_OP singleOrRecId TK_CL TK_SEM
Rule 49: ioStmt --> TK_WRITE TK_OP allVar TK_CL TK_SEM
Rule 50: allVar --> TK_NUM
Rule 51: allVar --> TK_RNUM
Rule 52: allVar --> TK_ID temp
Rule 53: arithmeticExpression -->term expPrime
Rule 54: expPrime -->lowPrecedenceOperators term expPrime
Rule 55: expPrime --> eps
Rule 56: term -->factor termPrime
Rule 57: termPrime -->highPrecedenceOperators factor termPrime
Rule 58: termPrime --> eps
Rule 59: factor --> TK_OP arithmeticExpression TK_CL
Rule 60: factor -->allVar
Rule 61: highPrecedenceOperators --> TK_MUL
Rule 62: highPrecedenceOperators --> TK_DIV
Rule 63: lowPrecedenceOperators --> TK_PLUS
Rule 64: lowPrecedenceOperators --> TK_MINUS
Rule 65: temp --> eps
Rule 66: temp --> TK_DOT TK_FIELDID
Rule 67: booleanExpression --> TK_OP booleanExpression TK_CL logicalOp TK_OP booleanExpression TK_CL
Rule 68: booleanExpression -->var relationalOp var
Rule 69: booleanExpression --> TK_NOT TK_OP booleanExpression TK_CL
Rule 70: var --> TK_ID
Rule 71: var --> TK_NUM
Rule 72: var --> TK_RNUM
Rule 73: logicalOp --> TK_AND
Rule 74: logicalOp --> TK_OR
Rule 75: relationalOp --> TK_LT
Rule 76: relationalOp --> TK_LE
Rule 77: relationalOp --> TK_EQ
Rule 78: relationalOp --> TK_GT
Rule 79: relationalOp --> TK_GE
Rule 80: relationalOp --> TK_NE
Rule 81: returnStmt --> TK_RETURN optionalReturn TK_SEM
Rule 82: optionalReturn --> TK_SQL idList TK_SQR
Rule 83: optionalReturn --> eps
Rule 84: idList --> TK_ID more_ids
Rule 85: more_ids --> TK_COMMA idList
Rule 86: more_ids --> eps