[antlr-interest] Syntax error "simplemodel.mo:syntax error: <AST>:9:16:"

Michael Sielemann michael.sielemann at asdl.gatech.edu
Thu Sep 29 13:58:28 PDT 2005



Hi everybody,
I am writing a parser to access some key information about models written in
this language Modelica.

I wrote the lexer and the parser so far and everything is going fine. After
bringing everything together the program doesn't throw any exceptions
however. Instead, it writes things like

    simplemodel.mo:syntax error: <AST>:9:16:

to the console. In http://www.antlr.org/doc/err.html or
http://www.jguru.com/faq/topicindex.jsp?topic=ANTLR I did not find an
answer. Google did not help either.

I am writing this for Python.

Does anyone know the reason for this? Below, I copied the console output
that leads to this.

Thanks, Michael






____



E:\antlr>antlr-2.7.5.exe modelica22parser\modelica22parser.g
ANTLR Parser Generator   Version 2.7.5 (20050201)   1989-2005 jGuru.com

E:\antlr>antlr-2.7.5.exe modelica22lexer\modelica22lexer.g
ANTLR Parser Generator   Version 2.7.5 (20050201)   1989-2005 jGuru.com

E:\antlr>d:\Python24\python.exe
ActivePython 2.4 Build 243 (ActiveState Corp.) based on
Python 2.4 (#60, Nov 30 2004, 09:34:21) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import Modelica22Lexer
>>> import Modelica22Parser
>>> L = Modelica22Lexer.Lexer("simplemodel.mo")
>>> P = Modelica22Parser.Parser(L)
>>> P.setFilename(L.getFilename())
>>> try:
...     P.stored_definition()
... except antlr.ANTLRException, ex:
...     print "*** errors while parsing ***"
...     import sys
...     sys.exit(1)
...
simplemodel.mo:syntax error: <AST>:9:16:
simplemodel.mo:syntax error: <AST>:10:16:
simplemodel.mo:syntax error: <AST>:11:15:
simplemodel.mo:syntax error: <AST>:12:16:
simplemodel.mo:syntax error: <AST>:13:16:
simplemodel.mo:syntax error: <AST>:14:15:
simplemodel.mo:syntax error: <AST>:15:16:
>>> ast = P.getAST()
>>> print "List: " + ast.toStringList()
List:  model circuit Resistor R1 R ( = 10 ) Capacitor C C ( = 0.01 )
Resistor R2 R ( = 100 ) Inductor L L ( = 0.1 ) VsourceAC AC Ground G
equation
>>>



More information about the antlr-interest mailing list