diff options
| author | Mel <einebeere@gmail.com> | 2021-10-23 22:01:52 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2021-10-23 22:01:52 +0200 |
| commit | 8a6eb35a900081967db16d313ab7ed470de6570f (patch) | |
| tree | d58dd702d8a742c7554545bc4e291480649e3663 /grammar.ebnf | |
| parent | da14afd74e1659af6ce4553360ac5dd0ce933db8 (diff) | |
| download | rabbithole-8a6eb35a900081967db16d313ab7ed470de6570f.tar.zst rabbithole-8a6eb35a900081967db16d313ab7ed470de6570f.zip | |
Loop expressions and concrete walker errors.
Diffstat (limited to 'grammar.ebnf')
| -rw-r--r-- | grammar.ebnf | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/grammar.ebnf b/grammar.ebnf index c4c6914..7428788 100644 --- a/grammar.ebnf +++ b/grammar.ebnf @@ -4,10 +4,12 @@ Program = {Statement} EOF; (* Statement *) -Statement = ExpressionStatement | ReturnStatement | PrintStatement; +Statement = ExpressionStatement | ReturnStatement | BreakStatement | ContinueExpression | PrintStatement; ExpressionStatement = Expression ";"; ReturnStatement = "return" Expression ";"; +BreakStatement = "break" [Expression] ";"; +ContinueStatement = "continue" ";"; (* NOTE: Hard-coded PrintStatement until Rabbithole has an standard library *) PrintStatement = "print" Expression ";"; @@ -27,7 +29,7 @@ UnaryExpression = ( "-" | "!" ) UnaryExpression | UnitExpression ; (* Unaffected Expressions *) -UnitExpression = FLOAT | INT | STR | TRUE | FALSE |GroupExpression | BlockExpression | FnExpression | TypeExpression | FormExpression | IfExpression; +UnitExpression = FLOAT | INT | STR | TRUE | FALSE | GroupExpression | BlockExpression | FnExpression | TypeExpression | FormExpression | IfExpression; GroupExpression = "(" Expression ")"; BlockExpression = Block; @@ -36,6 +38,7 @@ TypeExpression = "type" TypeBlock; (* NOTE: Will associated functions clash with fields? *) FormExpression = "form" TypeBlock; IfExpression = "if" Expression Block { "elif" Expression Block } [ "else" Block ]; +LoopExpression = "loop" ["if" Expression] Block; (* Parts *) |
