about summary refs log tree commit diff
path: root/grammar.ebnf
diff options
context:
space:
mode:
authorMel <einebeere@gmail.com>2021-10-20 22:15:08 +0200
committerMel <einebeere@gmail.com>2021-10-20 22:15:08 +0200
commita4980b8dbf1394c2b302f1de7c72d2264426b86e (patch)
tree97160332c53d8036ea3f6865ff60dabb2c55ef49 /grammar.ebnf
parent8d5a74566beba45f4642838102c5a066ef2aa18d (diff)
downloadrabbithole-a4980b8dbf1394c2b302f1de7c72d2264426b86e.tar.zst
rabbithole-a4980b8dbf1394c2b302f1de7c72d2264426b86e.zip
Statement parsing.
Diffstat (limited to 'grammar.ebnf')
-rw-r--r--grammar.ebnf12
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;