[antlr-interest] New to ANTLR; Problems with the grammar

Martin Probst mail at martin-probst.com
Thu Jun 1 08:37:51 PDT 2006


Hi,

> I get an error message which I don't understand and I can't find an  
> answer or link which brings me further...
>
> <!ENTITY commonVerification SYSTEM "../includes/ 
> commonVerification.xml">
> line 1:29: expecting SYS, found 'SYSTEM'
>
> Could anyone point me to the problem? Any hint is very much  
> appreciated.

The error message is a bit irritating, the issue is that the token  
"SYSTEM" is being lexed as a NAME, not as a SYS token - it matches  
the lexical specification of both NAME and SYS, so the lexer does not  
know how to handle it. You should get warnings about non-determinism  
from your grammar - these are not for decoration, they nearly always  
mean there is something wrong.

Are you sure you really want to implement an XML parser yourself,  
even though that for every possible programming language a multitude  
of well written, well tested parsers exist?

Regards,
Martin Probst


More information about the antlr-interest mailing list