-
Notifications
You must be signed in to change notification settings - Fork 0
/
AbstractSyntaxTreeDumpLanguageGrammar.txt
20 lines (20 loc) · 1.4 KB
/
AbstractSyntaxTreeDumpLanguageGrammar.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
AbstractSyntaxTree ::= ‘{‘ FunctionDeclaration ‘}’
FunctionDeclaration ::= “nil” | "function-declaration" '{' FunctionImplementation '}' '{' FunctionDeclaration '}''
FunctionImplementation ::= Identifier ‘{‘ FunctionImplementationParameter ’}’ ’{‘ Block ‘}’
Identifier ::= ['a'-'z' 'A'-'Z' '_'] ['a'-'z' 'A'-'Z' '0'-'9' '_']*
FunctionImplementationParameter ::= “nil” | "function-implementation-parameter" '{' FunctionImplementationParameter '}' '{' Variable '}'
Variable ::= Identifier “{nil} {nil}”
Block ::= Concatenation
Concatenation ::= “nil” | "concatenation" '{' Statement '}' '{' Concatenation '}'
Statement ::= If | While | Operator
If ::= "if" '{' Condition '}' '{' Block '}'
While ::= "while" '{' Condition '}' '{' Block '}'
Сondition ::= Expression
Operator ::= AssignmentOperator | FunctionСallOperator | Return | MathematicalOperator
AssignmentOperator ::= '=' '{' Variable '}' '{' Expression '}'
FunctionCallOperator ::= ‘$’##Identifier '{' FunctionCallParameter '}' "{nil}"
FunctionCallParameter ::= “nil” | "function-call-parameter" '{ FunctionCallParameter '}') '{' Expression '}'
Return ::= "return" '{' Expression '}' "{nil}"
MathematicalOperator ::= ['+' '-' '<' "<=" "==" '>' ">=" "||" '*' '/' "&&" '^'] '{' Expression '}' '{' Expression '}'
Expression ::= Variable | Number | FunctionCallOperator | MathematicalOperator
Number ::= ['0'-'9']+ “{nil} {nil}”