32 lines
532 B
Python
32 lines
532 B
Python
from lexer import Lexer
|
|
from parser import Parser
|
|
|
|
text_input = """
|
|
VOCA FORS
|
|
|
|
DESIGNA correct UT FORTIS_NUMERUS I C
|
|
DESIGNA guess UT NULLUS
|
|
|
|
DUM FALSITAS FACE {
|
|
DESIGNA guess UT AUDI_NUMERUS
|
|
SI guess MINUS correct TUNC {
|
|
DICE "Too low!"
|
|
} ALUID SI guess PLUS correct TUNC {
|
|
DICE "Too high!"
|
|
} ALUID {
|
|
ERUMPE
|
|
}
|
|
}
|
|
|
|
DICE "You guessed correctly!"
|
|
"""
|
|
|
|
lexer = Lexer().get_lexer()
|
|
pg = Parser()
|
|
pg.parse()
|
|
parser = pg.get_parser()
|
|
|
|
tokens = lexer.lex(text_input)
|
|
|
|
print(parser.parse(tokens))
|