17 lines
362 B
Python
17 lines
362 B
Python
|
from io import StringIO
|
||
|
|
||
|
from parser import Parser
|
||
|
from tokenio import TokenStream
|
||
|
from tokens import NumberTokenParser
|
||
|
|
||
|
texts = ["one plus one"
|
||
|
, "one plus two"
|
||
|
, "thirtytwo plus eleven"
|
||
|
, "four times four"
|
||
|
, "(eight plus eleven) times two"
|
||
|
, "twohundred through eleven"]
|
||
|
|
||
|
for text in texts:
|
||
|
print(text, "=", Parser(TokenStream(StringIO(text))).parse())
|
||
|
|