Click here to Skip to main content
15,883,901 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I was looking through grammar families when I had something I don't fully understand .

how to know/guess/prove/ a grammar belongs to any family ?

for example :
S -> A
A -> B | B a A
B -> b C
C -> C b | C x | epsilon


is it LR(0) ? is it SLR(1) ?
why?
and how u got that!?

thanks
Posted
Updated 5-Aug-11 10:33am
v2

1 solution

The following grammar (given in EBNF) accepts the same language:

S = b { b | x } { a b { b | x } } .

Not really answering your question, though. This one is LL(1).

You might take any decent textbook on that topic and check the definitions for LR(0) and SLR(1).
Of the given productions
- one is obviously left-recursive
- one is obviously right-recursive

Have fun!

Andi
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900