Files
centvrion/main.py
NikolajDanger 912c46ab7c
2022-06-08 13:08:19 +02:00

36 lines
585 B
Python

from lexer import Lexer
from parser import Parser
text_input = """
VOCA FORS
DESIGNA correct UT FORTIS_NUMERUS I C
DESIGNA gvess UT NULLUS
DUM FALSITAS FACE {
DESIGNA gvess UT AUDI_NUMERUS
SI gvess MINUS correct TUNC {
DICE "Too low!"
} ALUID SI gvess 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)
#for token in tokens:
# print(token)
x = parser.parse(tokens)
#print(x)
x.eval()