diff --git a/lexer.py b/lexer.py index 8f2c767..888f27a 100644 --- a/lexer.py +++ b/lexer.py @@ -78,7 +78,7 @@ t_ignore_COMMENT = r'//.*' # A regex rule with some action code def t_NUMBER(t): - r'[+-]*[(0-9).]+\b' + r'[+-]*[0-9.]+\b' t.value = t.value.replace("+", "") t.value = t.value.replace("--", "") t.value = float(t.value) diff --git a/parser.py b/parser.py index 94e1b2a..4f9b827 100644 --- a/parser.py +++ b/parser.py @@ -35,6 +35,10 @@ def p_factor_expr(p): 'factor : LPAREN expression RPAREN' p[0] = p[2] +def p_factor_compare(p): + 'factor : term ISEQUAL term' + p[0] = p[1] == p[2] + # Error rule for syntax errors def p_error(p): print("Syntax error in input!")