[antlr-interest] ANTLR3 Nested parser

Bertalan Fodor (LilyPondTool) lilypondtool at organum.hu
Wed Jan 23 06:16:38 PST 2008


Yes, this definitely applies, thank your for noting it. I have luck, 
because the 'start marker' is not used for anything else in the outer 
language, so I can go with the fragment lexer rules. They don't seem 
very difficult.

Bert
> I initially attempted to make this work by defining complicated
> fragment lexer rules in the 'outer' language in order to snarf the
> entire embedded language sequence.  Unfortunately that didn't work for
> this grammar due to the 'start marker' being ambiguous with other
> tokens.  In this language, it's difficult for the lexer to know whether
> input that starts with,
>
>    <foo
>
> is part of a comparison, i.e.,
>
>    bar<foo
>
> or part of an XML literal, i.e.,
>
>    <foo attr="33"/>
>
> OTOH, it's trivial for the parser to know what's ahead depending on the
> context it sees '<' in.
>
> If the '#(' is lexically unambiguous in your target syntax, your life
> will be easier that mine of course!  :)
>
>
> ta,
> dave
>
>   


-- 
LilyPondTool is the editor for LilyPond files.
See http://lilypondtool.organum.hu



More information about the antlr-interest mailing list