mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-28 16:48:03 +00:00
changed For to explicitly have an assignement in first and last place
This commit is contained in:
parent
1f0d690043
commit
706e6ee872
@ -19,14 +19,14 @@ param : type id;
|
|||||||
block : '{' (localVar | stmt)* '}';
|
block : '{' (localVar | stmt)* '}';
|
||||||
|
|
||||||
stmt : 'if' '(' expr ')' block ('else' block)? #If
|
stmt : 'if' '(' expr ')' block ('else' block)? #If
|
||||||
| 'for' '(' expr ';' expr ';' expr ')' block #For
|
| 'for' '(' assignement ';' expr ';' assignement ')' block #For
|
||||||
| 'while' '(' expr ')' block #While
|
| 'while' '(' expr ')' block #While
|
||||||
| 'do' block 'while' '(' expr ')' #DoWhile
|
| 'do' block 'while' '(' expr ')' #DoWhile
|
||||||
| 'return' expr ';' #Return
|
| 'return' expr ';' #Return
|
||||||
| 'return' ';' #ReturnVoid
|
| 'return' ';' #ReturnVoid
|
||||||
| 'break' ';' #Break
|
| 'break' ';' #Break
|
||||||
| 'continue' ';' #Continue
|
| 'continue' ';' #Continue
|
||||||
| id assignSign expr ';' #Assignment
|
| assignement ';' #Assignment
|
||||||
| stmtexpr ';' #StatementExpressionstmt
|
| stmtexpr ';' #StatementExpressionstmt
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -48,6 +48,7 @@ unaryOp : SUB | NOT;
|
|||||||
|
|
||||||
fieldId : (THIS '.')? (recipient '.')* id;
|
fieldId : (THIS '.')? (recipient '.')* id;
|
||||||
|
|
||||||
|
assignement : id assignSign expr ;
|
||||||
methCall : (THIS '.')? (recipient '.')* methName;
|
methCall : (THIS '.')? (recipient '.')* methName;
|
||||||
recipient : methName | id;
|
recipient : methName | id;
|
||||||
methName : id '(' args? ')';
|
methName : id '(' args? ')';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
package de.maishai.ast.records;
|
package de.maishai.ast.records;
|
||||||
|
|
||||||
|
|
||||||
public record For(Expression assign, Expression cond, Expression inc, Block block) implements Statement {
|
public record For(Assignment assign, Expression cond, Assignment inc, Block block) implements Statement {
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user