Improved parsing

This commit is contained in:
Sven Heidemann
2020-09-17 19:33:52 +02:00
parent cb54261118
commit dfc4b44b25
31 changed files with 717 additions and 189 deletions

View File

@@ -0,0 +1,9 @@
from typing import List
from Models.Interpreter.Token import Token
class AbstractSyntaxTree:
def __init__(self):
self.tokens: List[Token] = []

View File

@@ -0,0 +1,13 @@
from typing import List
from Models.AbstractSyntaxTree.Function import Function
from Models.AbstractSyntaxTree.Variable import Variable
class Class:
def __init__(self):
self.name: str = ''
self.variables: List[Variable] = []
self.functions: List[Function] = []
self.is_public = False

View File

@@ -0,0 +1,14 @@
from typing import List
from Models.AbstractSyntaxTree.Variable import Variable
from Models.Interpreter.Types import Types
class Function:
def __init__(self) -> None:
self.name: str = ''
self.variables: List[Variable] = []
self.instructions: [] = []
self.return_type: Types = Types.Any
self.is_public = False

View File

@@ -0,0 +1,9 @@
from Models.AbstractSyntaxTree.AbstractSyntaxTree import AbstractSyntaxTree
from Models.AbstractSyntaxTree.InstructionTypes import InstructionTypes
class Instruction:
def __init__(self):
self.type: InstructionTypes = InstructionTypes.Unknown
self.ast: AbstractSyntaxTree = AbstractSyntaxTree()

View File

@@ -0,0 +1,10 @@
from enum import Enum
class InstructionTypes(Enum):
Unknown = 0
Expression = 1
Bool_Expression = 2
Assignment = 3
Call = 4

View File

@@ -0,0 +1,11 @@
from typing import List
from Models.AbstractSyntaxTree.Class import Class
class Library:
def __init__(self):
self.name: str = ''
self.classes: List[Class] = []
self.is_public = False

View File

@@ -0,0 +1,9 @@
from typing import List
from Models.AbstractSyntaxTree.Library import Library
class RuntimeAbstractSyntaxTree:
def __init__(self):
self.libs: List[Library] = []

View File

@@ -0,0 +1,12 @@
from typing import List
from Models.Interpreter.Token import Token
class Variable:
def __init__(self):
self.name: str = ''
self.type: str = ''
self.value: List[Token] = []
self.is_public = False