CAP/TP02/demo_files/ex2/main.py
Emma Nardino ff5f2319ec Add TPO2
2024-09-23 11:04:28 +02:00

23 lines
571 B
Python

from antlr4 import InputStream
from antlr4 import CommonTokenStream
# include to use the generated lexer and parser
from Example2Lexer import Example2Lexer
from Example2Parser import Example2Parser
import sys
def main():
input_stream = InputStream(sys.stdin.read())
lexer = Example2Lexer(input_stream)
stream = CommonTokenStream(lexer)
parser = Example2Parser(stream)
parser.full_expr() # We want to recognize full_expr in grammar Example2
print("Finished")
# warns pb if py file is included in others
if __name__ == '__main__':
main()