[antlr-interest] File extensions for ANTLR 3

Prashant Deva prashant.deva at gmail.com
Thu Nov 30 14:03:57 PST 2006


The current file extensions for antlr 3 (its .g or .g3, i guess) does
not indicate in any way whether the grammar file contains a parser or
lexer. Also the file name itself doesnt indicate the name of the
parser/lexer.

I propose to let the extension of grammar files be something like
.gl,.gp & .glp which indicates instantly whether the file contains a
lexer, parser or both. Also like java the name of the file should be
the same as the name of the lexer inside.

Although, this may not seem as good as a plain .g, but this will help
tools like ANTLR Studio better figure out what the file contains and
provide you with greater assistance.  Remember the file extension is
for the machine anyway, it is the file name itself that is meant for
human consumtion.

This is especially important in my new tool Virtual Ant
(http://placidsystems.com/virtualant/)  in the part where it can
instantly show you the state of the file system after a certain ant
task has executed. Now currently for the 'antlr' task we will have to
parse the entire grammar file to make out what files it can produce.
This really slows us down and is very bad for the speed at which the
rest of the system runs. With more specific file extensions, we can
just look at the extension and tell the files that can be produced.

-- 
Prashant Deva
Creator, ANTLR Studio, Virtual Ant
Founder, Placid Systems, www.placidsystems.com


More information about the antlr-interest mailing list