You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
559 B

12 years ago
#!/usr/bin/env python
import antlr3
from OpenAirLexer import OpenAirLexer
from OpenAirParser import OpenAirParser
import sys
fin = file(sys.argv[1])
s = ""
for i in fin.xreadlines():
s += i
char_stream = antlr3.ANTLRStringStream(s)
# or to parse a file:
# char_stream = antlr3.ANTLRFileStream(path_to_input)
# or to parse an opened file or any other file-like object:
# char_stream = antlr3.ANTLRInputStream(file)
lexer = OpenAirLexer(char_stream)
tokens = antlr3.CommonTokenStream(lexer)
parser = OpenAirParser(tokens)