diff options
| author | Mel <einebeere@gmail.com> | 2021-10-20 22:15:08 +0200 |
|---|---|---|
| committer | Mel <einebeere@gmail.com> | 2021-10-20 22:15:08 +0200 |
| commit | a4980b8dbf1394c2b302f1de7c72d2264426b86e (patch) | |
| tree | 97160332c53d8036ea3f6865ff60dabb2c55ef49 /grammar.ebnf | |
| parent | 8d5a74566beba45f4642838102c5a066ef2aa18d (diff) | |
| download | rabbithole-a4980b8dbf1394c2b302f1de7c72d2264426b86e.tar.zst rabbithole-a4980b8dbf1394c2b302f1de7c72d2264426b86e.zip | |
Statement parsing.
Diffstat (limited to 'grammar.ebnf')
| -rw-r--r-- | grammar.ebnf | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/grammar.ebnf b/grammar.ebnf index 425c64a..d99f268 100644 --- a/grammar.ebnf +++ b/grammar.ebnf @@ -25,7 +25,7 @@ UnaryExpression = ( "-" | "!" ) UnaryExpression | UnitExpression ; (* Unaffected Expressions *) -UnitExpression = FLOAT | INT | STR | GroupExpression | BlockExpression | FnExpression | | TypeExpression | FormExpression | IfExpression; +UnitExpression = FLOAT | INT | STR | GroupExpression | BlockExpression | FnExpression | TypeExpression | FormExpression | IfExpression; GroupExpression = "(" Expression ")"; BlockExpression = Block; @@ -37,16 +37,14 @@ IfExpression = "if" Expression Block { "elif" Expression Block } [ "else" Block (* Parts *) -FnHeader = (FnSingleParameter | FnMultipleParameters) ["->" Type]; -FnSingleParameter = "self" | FnParameter; -FnMultipleParameters = "(" FnSingleParameter { "," FnParameter} ")"; -FnParameter = IdentiferType; +FnHeader = (FnParameters) ["->" Type]; +FnParameters = ("self" | FnParameter) { "," FnParameter}; (* Utils *) Block = "{" { Statement } [Expression] "}"; -TypeBlock = "{" [ IdentiferType ] { "," IdentiferType } "}"; +TypeBlock = "{" [ TypedIdentifier ] { "," TypedIdentifier } "}"; -IdentiferType = IDENTIFIER ":" Type; +TypedIdentifier = IDENTIFIER [":" Type]; (* NOTE: Type doesn't include anything other than simple named types for now. *) Type = IDENTIFIER; |
