-
Notifications
You must be signed in to change notification settings - Fork 0
/
recode_rules
157 lines (115 loc) · 6.76 KB
/
recode_rules
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
Program-<StatementList>
StatementList-<Statement><StatementList>
StatementList-<e>
StatementListBlock-<LeftCurlyBracket><StatementList><RightCurlyBracket>
LeftCurlyBracket-[Left curly bracket]{Create scope}
RightCurlyBracket-[Right curly bracket]{Destroy scope}
Statement-<SemicolonedVariableDeclaration>
Statement-<SemicolonedAssignment>
Statement-<If>
Statement-<For>
Statement-<While>
Statement-<Read>{Create LLVM read function}
Statement-<Write>{Create LLVM write function}
Statement-<StatementListBlock>
VariableDeclaration-<VariableDeclarationA><AssignmentSign><AssignmentRightHand>{Check variable type with AssignmentRightHand type for equality}{Add variable to scope}
VariableDeclarationA-<ExtendedType>[Identifier]{Check identifier for already existing}
SemicolonedVariableDeclaration-<VariableDeclaration>[Semicolon]
Assignment-<EnsureIdentifierIsExisting><AssignmentSign><AssignmentRightHand>{Check identifier type with AssignmentRightHand type for equality}{Update variable in scope}
EnsureIdentifierIsExisting-<ExtendedIdentifier>{Check identifier for existing}
SemicolonedAssignment-<Assignment>[Semicolon]
ExtendedIdentifier-[Identifier]<PossibleArrayAccessing>
PossibleArrayAccessing-[Left square bracket]<ExpressionList>[Right square bracket]
PossibleArrayAccessing-<e>
ExpressionList-<Expression><ExpressionListExtension>
ExpressionListExtension-[Comma]<ExpressionList>
ExpressionListExtension-<e>
AssignmentRightHand-<Expression>
AssignmentSign-[Assignment]
AssignmentSign-[Plus assignment]
AssignmentSign-[Minus assignment]
AssignmentSign-[Multiply assignment]
AssignmentSign-[Division assignment]
AssignmentSign-[Integer division assignment]
AssignmentSign-[Modulus assignment]
Literal-<StringLiteral>
Literal-<CharacterLiteral>
Literal-<BooleanLiteral>
Literal-<IntegerLiteral>
Literal-<FloatLiteral>
Literal-[Exponential]
Literal-<ArrayLiteral>{Create LLVM array literal}
StringLiteral-[String literal]{Create LLVM string literal}
CharacterLiteral-[Character literal]{Create LLVM character literal}
BooleanLiteral-[Boolean literal]{Create LLVM boolean literal}
IntegerLiteral-[Integer]{Create llvm integer value}
FloatLiteral-[Float]{Create llvm float value}
PossibleLiteral-<Literal>
PossibleLiteral-<e>
PossibleLiteralList-<PossibleLiteral><PossibleLiteralListExtension>
PossibleLiteralListExtension-[Comma]<PossibleLiteralList>
PossibleLiteralListExtension-<e>
ArrayLiteral-[Left square bracket]<PossibleLiteralList>[Right square bracket]
If-<IfCondition><StatementTrue><Else>{Goto post if statement label}{Start block previous}
Else-[Else keyword]<StatementFalse>
Else-<e>
IfCondition-[If keyword][Left round bracket]<Expression>[Right round bracket]{Create if statement}{Save post if statement to previous blocks}{Start block true}
StatementTrue-<Statement>{Goto post if statement label}{Start block false}
StatementFalse-<Statement>
Expression-<ArithmeticPlus>
ArithmeticPlus-<ArithmeticPlus>[Plus]<ArithmeticMinus>
ArithmeticPlus-<ArithmeticMinus>
ArithmeticMinus-<ArithmeticMinus>[Minus]<ArithmeticMultiply>
ArithmeticMinus-<ArithmeticMultiply>
ArithmeticMultiply-<ArithmeticMultiply>[Multiply]<ArithmeticDivision>
ArithmeticMultiply-<ArithmeticDivision>
ArithmeticDivision-<ArithmeticDivision>[Division]<ArithmeticIntegerDivision>
ArithmeticDivision-<ArithmeticIntegerDivision>
ArithmeticIntegerDivision-<ArithmeticIntegerDivision>[Integer division]<ArithmeticModule>
ArithmeticIntegerDivision-<ArithmeticModule>
ArithmeticModule-<ArithmeticModule>[Modulus]<LogicEquivalence>
ArithmeticModule-<LogicEquivalence>
LogicEquivalence-<LogicEquivalence>[Equivalence]<LogicNotEquivalence>
LogicEquivalence-<LogicNotEquivalence>
LogicNotEquivalence-<LogicNotEquivalence>[Not equivalence]<LogicMoreOrEquivalence>
LogicNotEquivalence-<LogicMoreOrEquivalence>
LogicMoreOrEquivalence-<LogicMoreOrEquivalence>[More or equal]<LogicLessOrEquivalence>
LogicMoreOrEquivalence-<LogicLessOrEquivalence>
LogicLessOrEquivalence-<LogicLessOrEquivalence>[Less or equal]<LogicMoreEquivalence>
LogicLessOrEquivalence-<LogicMoreEquivalence>
LogicMoreEquivalence-<LogicMoreEquivalence>[More]<LogicLessEquivalence>
LogicMoreEquivalence-<LogicLessEquivalence>
LogicLessEquivalence-<LogicLessEquivalence>[Less]<ArithmeticNegate>
LogicLessEquivalence-<ArithmeticNegate>
ArithmeticNegate-[Minus]<ArithmeticNegate>
ArithmeticNegate-[Left round bracket]<Expression>[Right round bracket]
ArithmeticNegate-<EnsureIdentifierIsExistingAndTryToLoadLlvmValueFromSymbolTable>
ArithmeticNegate-<Literal>
EnsureIdentifierIsExistingAndTryToLoadLlvmValueFromSymbolTable-<EnsureIdentifierIsExisting>{Try to load LLVM value from symbol table}
EnsureIdentifierIsExistingAndTryToLoadLlvmValueFromSymbolTableOrStringLiteral-<EnsureIdentifierIsExistingAndTryToLoadLlvmValueFromSymbolTable>
EnsureIdentifierIsExistingAndTryToLoadLlvmValueFromSymbolTableOrStringLiteral-<StringLiteral>
EnsureIdentifierIsExistingAndTryToReferenceLlvmValueFromSymbolTable-<EnsureIdentifierIsExisting>{Try to reference LLVM value from symbol table}
EnsureIdentifierIsExistingAndTryToReferenceLlvmValueFromSymbolTableOrStringLiteral-<EnsureIdentifierIsExistingAndTryToReferenceLlvmValueFromSymbolTable>
EnsureIdentifierIsExistingAndTryToReferenceLlvmValueFromSymbolTableOrStringLiteral-<StringLiteral>
For-[For keyword][Left round bracket]<VariableDeclaration>[Semicolon]<Expression>[Semicolon]<Assignment>[Right round bracket]<Statement>
While-<WhileCondition><Statement>{Goto block pre while}{End block pre while}{Start block previous}
WhileCondition-<WhileKeyword>[Left round bracket]<Expression>[Right round bracket]{Create block while}{Create while statement}{Start block while}
WhileKeyword-[While keyword]{Create block pre while}{Goto block pre while}{Start block pre while}
Read-[Read function][Left round bracket]<EnsureIdentifierIsExistingAndTryToLoadLlvmValueFromSymbolTableOrStringLiteral><ReadExtra>[Right round bracket][Semicolon]
ReadExtra-[Comma]<ReferencedIdentifierList>
ReadExtra-<e>
ReferencedIdentifierList-<EnsureIdentifierIsExistingAndTryToReferenceLlvmValueFromSymbolTableOrStringLiteral><ReferencedIdentifierListExtension>
ReferencedIdentifierListExtension-[Comma]<ReferencedIdentifierList>
ReferencedIdentifierListExtension-<e>
Write-[Write function][Left round bracket]<EnsureIdentifierIsExistingAndTryToLoadLlvmValueFromSymbolTableOrStringLiteral><WriteExtra>[Right round bracket][Semicolon]
WriteExtra-[Comma]<ValuedIdentifierList>
WriteExtra-<e>
ValuedIdentifierList-<EnsureIdentifierIsExistingAndTryToLoadLlvmValueFromSymbolTable><ValuedIdentifierListExtension>
ValuedIdentifierListExtension-[Comma]<ValuedIdentifierList>
ValuedIdentifierListExtension-<e>
ExtendedType-[Type]<PossibleArray>
PossibleArray-[Left square bracket]<IntegerList>[Right square bracket]
PossibleArray-<e>
IntegerList-[Integer]<IntegerListExtension>
IntegerListExtension-[Comma]<IntegerList>
IntegerListExtension-<e>