[antlr-interest] Another update to Honey Badger

Oliver Zeigermann oliver.zeigermann at gmail.com
Sun Jan 22 01:44:41 PST 2012


Tried it and it works great. I never quite groked when to use
channel(HIDDEN) and when skip, though. Can anyone clarify for me?

Thanks in advance!

- Oliver

2012/1/22 Terence Parr <parrt at cs.usfca.edu>:
> Hi, I have made an update to Honey Badger to allow special lexer commands to do the usual things without resorting to actions in the target language. This renders lexers almost always language neutral. Without actions in the parser, because of the parse trees, we should be very language neutral for honey badger grammars.
>
> In the lexer, you now have the choice of these commands:
>
>  skip
>  more
>  popMode
>  mode(x)
>  pushMode(x)
>  type(x)
>  channel(x)
>
> You can combine them with a comma and you can only have these commands at the end of an outer alternative:
>
> WS : (' '|'\n')+ -> skip ;
> WS : (' '|'\n')+ -> channel(HIDDEN) ;
>
> CURLY : '{' -> more, pushMode(BLOCKS) ;
>
> You can check it out here on the updated example page:
>
> http://www.antlr.org/wiki/display/ANTLR4/Examples
> http://www.antlr.org/depot/antlr4/main/CHANGES.txt
>
> Download here:
>
> http://antlr.org/download/antlr-4.0ea-complete.jar
>
> I will update the examples soon.
>
> Note that the old-style actions still work; these new commands simply translate to the raw actions. Obviously, if you need to do some logic before sending the token type, you will need to use an action in the target language.
>
> Enjoy,
> Ter
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list