[antlr-interest] Verilog VCD Parser

Mark Volkmann r.mark.volkmann at gmail.com
Sun Feb 10 06:33:01 PST 2008


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; }
  : ~('$')*
  ;

-- 
R. Mark Volkmann
Object Computing, Inc.


More information about the antlr-interest mailing list