Finish main task, start refactoring

This commit is contained in:
Jan-Niclas Loosen
2025-11-20 15:10:38 +01:00
parent 622ecef369
commit eb362896fd
8 changed files with 1415 additions and 208 deletions

View File

@@ -16,12 +16,13 @@ reserved = {
'false': 'FALSE'
}
# List of token names. This is always required
# List of token names. This is always requiredy
tokens = [
'ID',
'CONST',
'AOP',
'RELOP',
'COMP',
'EQOP',
'LOP',
'ASSIGN',
'LPAREN', 'RPAREN',
@@ -31,11 +32,11 @@ tokens = [
] + list(reserved.values())
# Simple tokens
t_LPAREN = r'\('
t_RPAREN = r'\)'
t_LBRACE = r'\{'
t_RBRACE = r'\}'
t_COMMA = r','
t_LPAREN = r'\('
t_RPAREN = r'\)'
t_LBRACE = r'\{'
t_RBRACE = r'\}'
t_COMMA = r','
t_SEMICOLON = r';'
t_ASSIGN = r'='
@@ -43,10 +44,13 @@ t_ASSIGN = r'='
t_AOP = r'\+|\-|\*|/'
# Comparison operators
t_RELOP = r'<=|>=|==|!=|<|>'
t_COMP = r'<=|>=|<|>'
# Equality operators
t_EQOP = r'\|\||&&|==|!='
# Logical operators
t_LOP = r'\|\||&&|==|!='
t_LOP = r'\|\||&&'
# IDs
def t_ID(t):