Skip to content

Commit ebf52bb

Browse files
committed
Compare sources
1 parent f9be57d commit ebf52bb

13 files changed

+82
-14
lines changed
1.59 KB
Binary file not shown.

__pycache__/lexer.cpython-39.pyc

1.72 KB
Binary file not shown.

__pycache__/nodes.cpython-39.pyc

2.22 KB
Binary file not shown.

__pycache__/parser_.cpython-39.pyc

2.05 KB
Binary file not shown.

__pycache__/tokens.cpython-39.pyc

884 Bytes
Binary file not shown.

__pycache__/values.cpython-39.pyc

514 Bytes
Binary file not shown.

interpreter_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import unittest
2-
32
from nodes import *
43
from interpreter import Interpreter
54
from values import Number

lexer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from tokens import Token, TokenType
22

3-
WHITESPACE = ' \n\r\t' # ignore characters
3+
WHITESPACE = ' \n\t'
44
DIGITS = '0123456789'
55

66
class Lexer:

lexer_test.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import unittest
2-
32
from tokens import Token, TokenType
43
from lexer import Lexer
54

main.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
11
from lexer import Lexer
2-
from parser import Parser
2+
from parser_ import Parser
33
from interpreter import Interpreter
44

55
while True:
66
try:
77
text = input("calc > ")
8-
98
lexer = Lexer(text)
10-
119
tokens = lexer.generate_tokens()
12-
print(list(tokens))
13-
1410
parser = Parser(tokens)
15-
1611
tree = parser.parse()
17-
print(tree)
1812
if not tree: continue
19-
2013
interpreter = Interpreter()
2114
value = interpreter.visit(tree)
2215
print(value)
2316
except Exception as e:
2417
print(e)
25-

0 commit comments

Comments
 (0)