[antlr-interest] Verilog VCD Parser
Amal Khailtash
akhailtash at gmail.com
Sun Feb 10 08:44:35 PST 2008
That's the problem. There is no restriction on comment/version content.
Especially version might have cvs keywords, say $revision, ...
On Feb 10, 2008 9:35 AM, Mark Volkmann <r.mark.volkmann at gmail.com> wrote:
> On Feb 10, 2008 8:33 AM, Mark Volkmann <r.mark.volkmann at gmail.com> wrote:
> > On Feb 9, 2008 11:05 PM, Amal Khailtash <akhailtash at gmail.com> wrote:
> > > Can someone please guide me to writing a grammar that can parse the
> > > following:
> > >
> > > $comment
> > > ANY CHARACTER HERE INCLUDING WHITESPACE
> > > $end
> > >
> > > $version
> > > ANY CHARACTER HERE INCLUDING WHITESPACE
> > > $end
> > >
> > > I am having problem with the text between the two keywords. Generally
> > > whitespace is ignored, but not if it is between $commen/$end or
> > > $version/$end.
> >
> > Here's a start, but it's not completely correct. I'll keep trying.
> >
> > grammar Verilog;
> >
> > script: block* EOF;
> >
> > block: comment | version;
> >
> > comment: '$comment' CONTENT '$end';
> >
> > version: '$version' CONTENT '$end';
> >
> > NEWLINE: ('\r'? '\n')+ { $channel = HIDDEN; };
> >
> > CONTENT
> > //options { greedy = false; }
> > : ~('$')*
> > ;
>
> Hey, this does work! I fell into that old trap of not selecting the
> correct start rule in ANTLRWorks. The downside of my grammar is that
> you can't have a '$' in the content of a comment or version.
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080210/cde72d6c/attachment.html
More information about the antlr-interest
mailing list