File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
PascalInterpreter/PascalInterpreter/Parser Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -323,6 +323,11 @@ public class Parser {
323323 return RepeatUntil ( statement: statements. count == 1 ? statements [ 0 ] : Compound ( children: statements) , condition: condition)
324324 }
325325
326+ /**
327+ Rule:
328+
329+ for_loop : FOR variable ASSIGN expression TO expression DO statement
330+ */
326331 private func forLoop( ) -> For {
327332 eat ( . for)
328333 let variable = self . variable ( )
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ statement : compound_statement
2727 | if_else_statement
2828 | assignment_statement
2929 | repeat_until
30+ | for_loop
3031 | empty
3132
3233function_call : id LPAREN (factor (factor COLON)* )* RPAREN (COLON type_spec){0,1}
@@ -39,6 +40,8 @@ condition : expr (= | < | >) expr
3940
4041repeat_until : REPEAT statement UNTIL condition
4142
43+ for_loop : FOR variable ASSIGN expression TO expression DO statement
44+
4245assignment_statement : variable ASSIGN expr
4346
4447empty :
You can’t perform that action at this time.
0 commit comments