Skip to content

Commit 83544aa

Browse files
committed
Remove assignmentOperator and relationOperator
1 parent 08293df commit 83544aa

File tree

4 files changed

+267
-387
lines changed

4 files changed

+267
-387
lines changed

MyParser.g4

+8-19
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,17 @@ whileLoop
5353
;
5454

5555
comparison
56-
: expression relationOperator expression
56+
: expression (LE | GE | EQ | NE | LEQ | GEQ) expression
5757
;
5858

5959
assignment
60-
: (id | elementReference) assignmentOperator expression SEMICOLON
60+
: (id | elementReference) (
61+
ASSIGN
62+
| ASSIGN_PLUS
63+
| ASSIGN_MINUS
64+
| ASSIGN_MULTIPLY
65+
| ASSIGN_DIVIDE
66+
) expression SEMICOLON
6167
;
6268

6369
print
@@ -106,23 +112,6 @@ elementReference
106112
: id OPEN_BRACKET_SQUARE int (COMMA int)* CLOSE_BRACKET_SQUARE
107113
;
108114

109-
assignmentOperator
110-
: ASSIGN
111-
| ASSIGN_PLUS
112-
| ASSIGN_MINUS
113-
| ASSIGN_MULTIPLY
114-
| ASSIGN_DIVIDE
115-
;
116-
117-
relationOperator
118-
: LE
119-
| GE
120-
| EQ
121-
| NE
122-
| LEQ
123-
| GEQ
124-
;
125-
126115
id
127116
: ID
128117
;

generated/MyParser.interp

+1-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)