[antlr-interest] Code generation weirdness?

Johannes Luber JALuber at gmx.de
Wed Jan 30 13:03:02 PST 2008


> The problem is that choosing the name "object" is probably a bad idea for
> many reasons, and things blow up.
> _______
> Traceback (most recent call last):
> File "jsonParser.py", line 44, in <module>
> class jsonParser(Parser):
> File "jsonParser.py", line 593, in jsonParser
> class array_return(object):
> TypeError: Error when calling the metaclass bases
> function() argument 1 must be code, not str
> _______
> 
> Changing the grammar's AST tree label to "j_object" fixes the problems.
> 
> Is there a reason that these generated classnames don't have some sort of
> default prefix for language safety? Could such a thing be reasonably
> implemented? It seems like a big pitfall that grammar rule names can
> collide with target language keywords.
> It's possible that there was some warning about this kind of bug and I
> missed it...
> 

I don't know, if the writer did test the grammar or not, but there is no capability for prefixing the function names yet. It is planned to include it sometime in the future although I don't know if Ter already chose a version yet.

Johannes
-- 
GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail


More information about the antlr-interest mailing list