diff --git a/grammar/core/base_types.bnf b/grammar/core/base_types.bnf index 8f2b50a..a43fcd9 100644 --- a/grammar/core/base_types.bnf +++ b/grammar/core/base_types.bnf @@ -1,14 +1,12 @@ - ::= | | | + ::= | | | - ::= "String" | "Integer" | "Decimal" | "Boolean" + ::= | | | - ::= ["/" ] - - ::= "<>" + ::= ::= - | "Runnable" + | | | "Any" - ::= "[" ("," )* "]" | "Runnable" + ::= "[" ("," )* "]" | diff --git a/grammar/core/identifiers.bnf b/grammar/core/identifiers.bnf index d7b0ca8..3551ccc 100644 --- a/grammar/core/identifiers.bnf +++ b/grammar/core/identifiers.bnf @@ -4,7 +4,7 @@ ::= - ::= "my." + ::= ::= | @@ -13,3 +13,8 @@ ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" + + ::= "!" | "@" | "#" | "$" | "%" | "^" | "&" | "*" | "(" | ")" | "-" | "_" | "+" | "=" | "[" | "]" | "{" | "}" | "|" | "\" | ":" | ";" | "<" | ">" | "," | "." | "?" | "/" + + ::= " " | "\t" | "\n" | "\r" + diff --git a/grammar/core/keywords.bnf b/grammar/core/keywords.bnf new file mode 100644 index 0000000..54366f2 --- /dev/null +++ b/grammar/core/keywords.bnf @@ -0,0 +1,57 @@ + ::= "fn" + + ::= "->" + + ::= "String" + + ::= "Integer" + + ::= "Decimal" + + ::= "Boolean" + + ::= "Runnable" + + ::= "True" + + ::= "False" + + ::= "Null" + + ::= "<" + + ::= ">" + + ::= "my." + + ::= "+" + + ::= "" + + ::= "-" + + ::= "fails with" + + ::= "on_create" + + ::= "on_destroy" + + ::= "use" + + ::= "if" + + ::= "orif" + + ::= "otherwise" + + ::= "while" + + ::= "loop" + + ::= "rloop" + + ::= "rtn" + + ::= "using" + + ::= "fail" \ No newline at end of file diff --git a/grammar/core/literals.bnf b/grammar/core/literals.bnf index 02156a5..5c1d563 100644 --- a/grammar/core/literals.bnf +++ b/grammar/core/literals.bnf @@ -12,13 +12,24 @@ ::= + "." + | "-" + "." + - ::= '"' [^\"]* '"' - | "'" [^']* "'" + ::= | - ::= "True" | "False" + ::= * + ::= * - ::= "Null" + ::= + ::= - ::= "<" ? ">" + ::= "\"" + ::= "'" + + ::= | | | + ::= | | | + + ::= | + + ::= + + ::= ? ::= ("," )* diff --git a/grammar/core/visibility.bnf b/grammar/core/visibility.bnf index e03c6f6..05b8afe 100644 --- a/grammar/core/visibility.bnf +++ b/grammar/core/visibility.bnf @@ -1,4 +1,4 @@ ::= - "-" - | "" - | "+" + + | + | diff --git a/grammar/declarations/error_declarations.bnf b/grammar/declarations/error_declarations.bnf index 9a6a145..21e5d5e 100644 --- a/grammar/declarations/error_declarations.bnf +++ b/grammar/declarations/error_declarations.bnf @@ -1,7 +1,7 @@ ::= "{" ? "}" - ::= [ "/"]? + ::= ( "/")? ::= diff --git a/grammar/declarations/function_declarations.bnf b/grammar/declarations/function_declarations.bnf index 6312dce..264a36a 100644 --- a/grammar/declarations/function_declarations.bnf +++ b/grammar/declarations/function_declarations.bnf @@ -1,14 +1,14 @@ - ::= "fn" + ::= - ["fails" "with" ]? + ( )? "{" * "}" ::= "(" ? ")" - "->" + ::= ("," )* - ::= ["/" ]? + ::= ("/" )? ::= ? @@ -30,6 +30,6 @@ ::= ".default(" ")" - ::= "fn" "(" ? ")" - "->" "[" "]" + ::= "(" ? ")" + "[" "]" "{" * "}" diff --git a/grammar/declarations/type_declarations.bnf b/grammar/declarations/type_declarations.bnf index 9ac24b1..fecf5fe 100644 --- a/grammar/declarations/type_declarations.bnf +++ b/grammar/declarations/type_declarations.bnf @@ -8,7 +8,7 @@ | | )* - ::= [ "/"]? + ::= ( "/")? ::= @@ -17,17 +17,17 @@ ::= ("," )* ::= - [".set(" ")"]? ";" + (".set(" ")")? ";" ::= ".define(" ");" ::= - "on_create" "(" ? ")" - ["fails" "with" ]? + "(" ? ")" + ( )? "{" * "}" ::= - "on_destroy" "(" ? ")" - ["fails" "with" ]? + "(" ? ")" + ( )? "{" * "}" diff --git a/grammar/interfaces/interface_definitions.bnf b/grammar/interfaces/interface_definitions.bnf index 5f8163d..d9a8027 100644 --- a/grammar/interfaces/interface_definitions.bnf +++ b/grammar/interfaces/interface_definitions.bnf @@ -1,4 +1,4 @@ - ::= "@" [ "/"]? + ::= "@" ( "/")? "{" "}" ::= @@ -8,9 +8,9 @@ ::= * ::= - "fn" ";" + ";" - ::= "->" + ::= "[" "]" ::= - "fn" + diff --git a/grammar/main.bnf b/grammar/main.bnf index c243549..8c09f7b 100644 --- a/grammar/main.bnf +++ b/grammar/main.bnf @@ -1,12 +1,13 @@ ::= * * - ::= "use" ("." )* ";" + ::= ("." )* ";" ::= | | +import "core/keywords.bnf" import "core/base_types.bnf" import "core/identifiers.bnf" import "core/literals.bnf" diff --git a/grammar/operations/control_flow.bnf b/grammar/operations/control_flow.bnf index 32f073e..e3d34f1 100644 --- a/grammar/operations/control_flow.bnf +++ b/grammar/operations/control_flow.bnf @@ -11,31 +11,31 @@ ::= ".set(" ")" ";" - ::= "if" "(" ")" + ::= "(" ")" "{" * "}" - ["orif" "(" ")" "{" * "}"]? - ["otherwise" "{" * "}"]? + ( "(" ")" "{" * "}")? + ( "{" * "}")? - ::= "while" "(" ")" + ::= "(" ")" "{" * "}" - ::= "loop" "(" "," "->" - ["," ]? ")" + ::= "(" "," "->" + ("," )? ")" "{" * "}" - ::= "rloop" "(" "," "->" - ["," ]? ")" + ::= "(" "," "->" + ("," )? ")" "{" * "}" ::= "(" ? ")" ";" - ::= "rtn" ";" + ::= ";" - ::= "using" ".set(" ")" + ::= ".set(" ")" "{" * "}" ::= ".attempt" "{" * "}" ::= ("ok" | | "error") "{" * "}" - ::= ".fail(" ["(" ? ")"]? ")" ";" + ::= "." "(" ("(" ? ")")? ")" ";" diff --git a/grammar/operations/expressions.bnf b/grammar/operations/expressions.bnf index 7a82e23..2231967 100644 --- a/grammar/operations/expressions.bnf +++ b/grammar/operations/expressions.bnf @@ -20,13 +20,13 @@ | ".lte(" ")" | ".and(" ")" | ".or(" ")" - | "Boolean.and(" "," ")" - | "Boolean.or(" "," ")" - | "Boolean.not(" ")" - | "Boolean.eq(" "," ")" - | "Boolean.is(" "," ")" - | "Boolean.gt(" "," ")" - | "Boolean.lt(" "," ")" - | "Boolean.gte(" "," ")" - | "Boolean.lte(" "," ")" + | ".and(" "," ")" + | ".or(" "," ")" + | ".not(" ")" + | ".eq(" "," ")" + | ".is(" "," ")" + | ".gt(" "," ")" + | ".lt(" "," ")" + | ".gte(" "," ")" + | ".lte(" "," ")"