|Quick way to recognize grammar type email@example.com (2004-02-01)|
|Re: Quick way to recognize grammar type firstname.lastname@example.org (2004-02-04)|
|Re: Quick way to recognize grammar type email@example.com (Joachim Durchholz) (2004-02-04)|
|Re: Quick way to recognize grammar type cfc@shell01.TheWorld.com (Chris F Clark) (2004-02-04)|
|Re: Quick way to recognize grammar type firstname.lastname@example.org (2004-02-08)|
|Re: Quick way to recognize grammar type email@example.com (Tim Bauer) (2004-02-08)|
|From:||Joachim Durchholz <firstname.lastname@example.org>|
|Date:||4 Feb 2004 21:31:25 -0500|
|Organization:||Oberberg Online Infosysteme|
|Posted-Date:||04 Feb 2004 21:31:25 EST|
> Is there any way of determining quickly if a given grammar is one of
> LL(0)/LR(0)/LALR/LR(1). I know that we can construct the set of items
> and hence the parsing table. But I am looking for some tricks/tips
> by which we can quickly determine if the grammar is one of the above
> four types.
A grammar isn't LL if it has left-recursive rules, e.g.
A ::= A B
When designing a language for LL, I try to make sure that all
alternatives start with a unique identifier, and I avoid empty
productions where possible. This gives me a good first start.
For the remaining grammar classes, I haven't seen any quick rules.
Intuitively, a grammar is LR (0) if you can take a valid token
sequence, chop it in two, and still make sense of the left part. For
LR (1), you're allowed to take a look at the first chopped-off token
before trying to make sense of the code.
Not sure about the differences between LR and LALR; I recall dimly
that LALR and LR are essentially the same, but I might be totally
wrong with that.
Currently looking for a new job.
Return to the
Search the comp.compilers archives again.