[antlr-interest] Grammar help

Bart Kiers bkiers at gmail.com
Mon Mar 15 23:35:08 PDT 2010


On Tue, Mar 16, 2010 at 4:54 AM, Brian Catlin <BrianC at sannas.org> wrote:

>
> When I compile the grammar with ANTLR, I get the following:
>
>
>
> warning(149): Commands.g:0:0: rewrite syntax or operator with no output
> option; setting output=AST
>


Hi Brian,

The '!' and '^' are tree-rewrite operators, so ANTLR is telling you here
that you're trying to rewrite something without specifying you're building a
tree. Doing a CRL+F I found this rule:

commands
  :  ( script_command
     | dump_command
            ! show_command // <- !
     )*
  ;

Notice the '!' (exclamation mark) that should be a '|' (pipe):

commands
   :  ( script_command
     | dump_command
            | show_command // <- |
     )*
  ;

Regards,

Bart.


More information about the antlr-interest mailing list