[antlr-interest] [antlr-dev] generating code from grammar (CSS) and large code.
Loring Craymer
lgcraymer at yahoo.com
Tue May 13 15:47:38 PDT 2008
I've switched groups from antlr-dev to antlr-interest; this discussion does not belong in antlr-dev.
ANTLR 3 tends to generate large files, and you have enough special tokens that an 80K line lexer is not unusual. This is a transient situation: one of the later releases will probably focus on minimizing the size of generated code.
Your error message points to "TERM"; this should be converted to a parser rule as a first step (that should also reduce code gen size), and you will probably need to inline your fragment rules (lexers do not yet use FOLLOW sets--for the moment, avoid using fragment rules).
--Loring
----- Original Message ----
From: Kamal Verma <kverma at yahoo.com>
To: antlr-dev at antlr.org
Sent: Tuesday, May 13, 2008 2:38:56 PM
Subject: [antlr-dev] generating code from grammar (CSS) and large code.
Problem generating code from grammar.
CSS.g:203:2: The following alternatives are unreachable: 5,6,7,11,12
I am having trouble generating the code. Any help is very much appreciated. Also if anybody have a CSS parser created please share :-).
Somehow it generated the code but size of code is too large. ~80k lines.
--------------
$ wc -l *
296 CSS.g
97 CSS.tokens
79701 CSSLexer.cs
1925 CSSParser.cs
236 CSS__.g
82255 total
--------------
Attached it the v3 grammar file.
Original grammar: http://www.antlr.org/share/1126882028006/css2.1.g
Grammar specs: http://www.w3.org/TR/CSS21/grammar.html
Any help is greatly appreciated.
-Kamal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080513/e05b385d/attachment.html
More information about the antlr-interest
mailing list