[antlr-interest] Newbie: Reccomendations needed

Terence Parr parrt at cs.usfca.edu
Wed Jul 19 15:39:56 PDT 2006


On Jul 19, 2006, at 11:40 AM, Harsh Chilwal wrote:

>     Hi,
>         I am not a parser expert and also new to Antlr. I have an  
> intruging problem more.
>         We have to do a verilog language parser. As part of the our  
> flow, we have added some constructs to the language.
>         Now we are using a 3rd party language parser which does not  
> understand those constructs.
>         The constructs are very simple. I dont want to modify the  
> 3rd party parser to make it understand our constructs. Instead i  
> want to write a preprocessor which can filter out our constructs  
> and churn out standard verilog to the 3rd party parser.
>        Is Antlr a good tool to write a preprocessor for verilog/c  
> kind of a language. I  would need to handle file inclusions, macro  
> processing.

The includes are probably easiest with a smart channel of  
characters.  Then, yes, macros and such are great in ANTLR.  You  
could translate the token stream into another token stream and then  
parse w/o relexing if you wanted.

> Somewhere i have read about channels in Antlr3. Can i make a  
> verilog channel and pass standard verilog to that channel and our  
> constructs to a different channel.

Sure.  you can only parse one channel at a time though.

Ter

>        Basically i am trying to creat a language filter which can  
> seperate out 2 language tokens into different channels.
>        Any suggestion will be really appreciated.
> Thanks in advance,
> regards,
> Harsh



More information about the antlr-interest mailing list