Added differentiation between yield statement and yield expressions and added missing semicolon to delStmt

This commit is contained in:
Nocturn9x 2021-10-23 12:46:11 +02:00
parent 7dc9ea17d5
commit 118b8e5ffc
1 changed files with 3 additions and 2 deletions

View File

@ -88,7 +88,8 @@ returnStmt → "return" expression? ";"; // Returns from a function, illega
breakStmt → "break" ";";
importStmt -> ("from" IDENTIFIER)? "import" (IDENTIFIER ("as" IDENTIFIER)? ","?)+ ";";
assertStmt → "assert" expression ";";
delStmt → "del" expression ";"
delStmt → "del" expression ";";
yieldStmt → "yield" expression ";";
continueStmt → "continue" ";";
blockStmt → "{" declaration* "}"; // Blocks create a new scope that lasts until they're closed
ifStmt → "if" "(" expression ")" statement ("else" statement)?; // If statements are conditional jumps
@ -100,7 +101,7 @@ foreachStmt → "foreach" "(" (IDENTIFIER ":" expression) ")" statement;
// Expressions (rules that produce a value, but also have side effects)
expression → assignment;
assignment → (call ".")? IDENTIFIER "=" yield; // Assignment is the highest-level expression
yield → "yield" expression;
yield → "(" "yield" expression ")";
logic_or → logic_and ("and" logic_and)*;
logic_and → equality ("or" equality)*;
equality → comparison (( "!=" | "==" ) comparison )*;