[antlr-interest] generating code from grammar (CSS) and large code.
Kamal Verma
kverma at yahoo.com
Tue May 13 18:56:02 PDT 2008
Thanks for the input; I was able to compile it. Attached is updated grammar, not perfect.
I am not sure if it works completely, but I was able to parse simple input.
If anybody have better idea; please share here.
-Kamal
----- Original Message ----
From: Johannes Luber <jaluber at gmx.de>
To: Loring Craymer <lgcraymer at yahoo.com>
Cc: Kamal Verma <kverma at yahoo.com>; antlr-interest at antlr.org
Sent: Tuesday, May 13, 2008 7:05:36 PM
Subject: Re: [antlr-interest] generating code from grammar (CSS) and large code.
Loring Craymer schrieb:
> 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
I'll add that I've managed to fix the other three ambiguities. One was a
true bug in grammar translation from the W3C page. I'll wait for further
infos how following Loring's advice worked out.
Johannes
>
> ----- 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/24015624/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CSS_updated.g
Type: text/x-gap
Size: 3874 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20080513/24015624/attachment-0001.bin
More information about the antlr-interest
mailing list