about summary refs log tree commit diff stats
path: root/js/scripting-lang/grammar.ebnf
diff options
context:
space:
mode:
Diffstat (limited to 'js/scripting-lang/grammar.ebnf')
-rw-r--r--js/scripting-lang/grammar.ebnf76
1 files changed, 0 insertions, 76 deletions
diff --git a/js/scripting-lang/grammar.ebnf b/js/scripting-lang/grammar.ebnf
deleted file mode 100644
index b595c87..0000000
--- a/js/scripting-lang/grammar.ebnf
+++ /dev/null
@@ -1,76 +0,0 @@
-(* Scripting Language Grammar *)
-
-(* Program Structure *)
-program = statement_list
-statement_list = statement { statement }
-statement = assignment | function_declaration | expression | io_statement | ";"
-
-(* Variables and Assignment *)
-assignment = identifier ":" value
-value = expression | function_call
-
-(* Function Declarations *)
-function_declaration = identifier ":" parameter_list "->" function_body
-parameter_list = identifier { identifier }
-function_body = expression | case_expression
-
-(* Expressions *)
-expression = arithmetic_expression | identifier | number | string
-
-(* Arithmetic Expressions *)
-arithmetic_expression = arithmetic_operator expression expression
-arithmetic_operator = "+" | "-" | "*" | "/"
-
-(* Function Calls *)
-function_call = identifier argument_list
-argument_list = expression { expression }
-
-(* Case Expressions *)
-case_expression = "case" value_list "of" case_list
-value_list = expression { expression }
-case_list = case_branch { case_branch }
-case_branch = pattern ":" result
-pattern = pattern_element { pattern_element }
-pattern_element = number | wildcard | identifier
-result = result_element { result_element }
-result_element = string | number | identifier
-
-(* IO Statements *)
-io_statement = io_operator [ expression ]
-io_operator = "..in" | "..out"
-
-(* Terminals *)
-identifier = letter { letter | digit }
-number = digit { digit }
-string = '"' { character } '"'
-wildcard = "_"
-letter = "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" | "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"
-digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
-character = letter | digit | " " | "!" | "#" | "$" | "%" | "&" | "'" | "(" | ")" | "*" | "+" | "," | "-" | "." | "/" | ":" | ";" | "<" | "=" | ">" | "?" | "@" | "[" | "\" | "]" | "^" | "`" | "{" | "|" | "}" | "~"
-
-(* Comments *)
-(* This language does not support comments *)
-
-(* Examples *)
-
-(* Variable assignment *)
-(* x : 5; *)
-
-(* Function declaration *)
-(* add : x y -> x + y; *)
-
-(* Function call *)
-(* result : add 3 4; *)
-
-(* Case expression *)
-(* compare : x y -> 
-   case x y of
-     0 0 : "both zero"
-     0 _ : "x is zero"
-     _ 0 : "y is zero"
-     _ _ : "neither zero"; *)
-
-(* IO statements *)
-(* name : ..in;
-   ..out "Hello, ";
-   ..out name; *) 
\ No newline at end of file