[antlr-interest] Parsing this ambiguous grammar

Jim Idle jimi at temporal-wave.com
Fri Jan 27 14:30:08 PST 2012


You just need a small piece of hand written Java code. Don't even bother
with a lexer.

Jim

> -----Original Message-----
> From: Gerald Gutierrez [mailto:gerald.gutierrez at gmail.com]
> Sent: Friday, January 27, 2012 2:23 PM
> To: Jim Idle
> Cc: antlr-interest at antlr.org
> Subject: Re: [antlr-interest] Parsing this ambiguous grammar
>
> On Fri, Jan 27, 2012 at 12:25, Jim Idle <jimi at temporal-wave.com> wrote:
> > However, I am taking your grammar at its word that A B or C must
> > always be PITCH. I also assume that you cannot have ' ' in your ID or
> > you have no way at all to disambiguate except for context. However,
> > this may come from a hand crafted context sensitive parser made by a
> > musician not a programmer and so you will have to jump through hoops
> > in the parser to try and make it work.
>
> The real goal here is to parse an RTTTL file by embodying the entirety
> of the RTTTL file format in ANTLR. The RTTTL spec was developed by
> Nokia and is described here:
>
> http://www.csoft.co.uk/ringtones/rtttl_rtx.htm
>
> An example is:
>
> Entertainer:d=4,o=5,b=200:8d,8d#,8e,c6,8e,c6
>
> It starts with a name, which can have any displayable character. A, B,
> C do not have to be the pitch. They can be the name as well.
>
> Given what has been said, it is not possible to cleanly describe RTTTL
> in ANTLR. We (me & my friend who originated this) haven't found a
> solution and a clean solution doesn't seem forthcoming.
>
> Which means to me that we're back to regular expressions. Best way to
> go given the situation?
>
>
> Gerald.


More information about the antlr-interest mailing list