[antlr-interest] ANTLR 3 Lexical States

lilypondtool at organum.hu lilypondtool at organum.hu
Fri Jan 25 12:54:39 PST 2008


Or to answer myself: perhaps I'll try making an island grammar for all 
the possible lexical states.

Bert

Quoting Bertalan Fodor <lilypondtool at organum.hu>:

>
>
>> What is it you are trying
>> to parse?
> It is the LilyPond grammar.
>
> I think this example will explain:
>
> In 'initial' state the \w+ words mean variables, so if you read var, 
> there should be a 'var' variable defined.
> However, in an other state, let's call it 'markup' everything is 
> allowed and interpreted as string literals:
> \markup { everything can go here, even +- and whatever
> In this mode you can switch to another mode with a command like this: 
> \normalMode { var },  }
>
> So lexical states can be nested.
>
> I'm going to be afraid that antlr 3 won't really suit.
>
> Bert
>
>




More information about the antlr-interest mailing list