Files
centvrion/main.py
NikolajDanger f4c608aaf2
2022-06-08 16:16:20 +02:00

36 lines
588 B
Python

from lexer import Lexer
from parser import Parser
text_input = """
VOCA FORS
DESIGNA correct VT FORTIS_NVMERVS I C
DESIGNA gvess VT NVLLVS
DVM FALSITAS FACE {
DESIGNA gvess VT AVDI_NVMERVS
SI gvess MINVS correct TVNC {
DICE "Too low!"
} ALVID SI gvess PLVS correct TVNC {
DICE "Too high!"
} ALVID {
ERVMPE
}
}
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()