[DevState] Improved Parsing for AST Lib, Class, Func, Var, Call

This commit is contained in:
Sven Heidemann
2020-09-23 19:38:14 +02:00
parent 7058927970
commit fa2a42dcc8
11 changed files with 664 additions and 181 deletions

View File

@@ -1,40 +1,6 @@
LibraryDefinition:
IsPublic: <True, False>
Name: <NAME>
ClassDefinition:
IsPublic: <True, False>
Name: <NAME>
Instructions: <LIST OF SUB AST>
FunctionDefinition:
IsPublic: <True, False>
Name: <NAME>
Arguments: <LIST OF VariableDefinition>
ReturnType: <Bool, String, Num, Empty, Any>
Instructions: <LIST OF SUB AST>
VariableDefinition:
IsPublic: <True, False>
Name: <NAME>
Type: <Bool, String, Num, Empty, Any>
Value: <LIST OF SUB AST>
IsAbleToBeEmpty: <True, False>
FunctionCall:
Function: <NAME, ID>
Arguments: <LIST OF SUB AST>
Assignment:
Target: <NAME, ID>
Value: <LIST OF SUB AST>
Operation:
Type: <+, -, *, />
Arguments: <LIST OF SUB AST>
Value:
Value: <1-9, '', true/false>
Type: <Bool, String, Number>
operation: number <+, -, *, /> number
lib def: <public> lib Name {
class def: <public> class Name {
func def: <public> func Name(arg: type<, more args>) {
var def: <public> var Name: type<= value>;

64
doc/ast_test.json Normal file
View File

@@ -0,0 +1,64 @@
{
"libraries": [
{
"is_public": "True",
"name": "Main",
"classes": [
{
"is_public": "False",
"name": "Program",
"variables": [
{
"is_public": "False",
"name": "test",
"type": "bool",
"value": "false"
},
{
"is_public": "False",
"name": "test2",
"type": "Program2",
"value": "empty"
},
{
"is_public": "False",
"name": "test3",
"type": "Program2",
"value": {}
}
],
"functions": [
{
"is_public": "False",
"name": "Main",
"args": [],
"return_type": "empty",
"instructions": [
{
"is_public": "False",
"name": "hallo",
"type": "any",
"value": "empty"
}
]
},
{
"is_public": "False",
"name": "isTrue",
"args": [
{
"is_public": "False",
"name": "value",
"type": "bool",
"value": "empty"
}
],
"return_type": "bool",
"instructions": []
}
]
}
]
}
]
}

2
doc/todo.txt Normal file
View File

@@ -0,0 +1,2 @@
Todo:
- parse function