views:

57

answers:

1

I have an assignment to correct an ambiguous BNF, but I am completely lost. I know this not a true programming question, and I will gladly delete it if it is not an appropriate question for these boards. Are there any good sites where I could learn more about BNF's? The one I am dealing with seems rather simple, but I can't find any examples or good explanations regarding BNF's. I have had some experience spotting ambiguous parse trees and other sorts of grammars, but I am completely lost on this one.

Since it is a school assignment, I am not sure I should post the BNF in question, but if anyone knows of a good site that I could look over to perhaps gain a better understanding of how to attack my question. I really just don't know where to start.

+1  A: 

Some BNF describing a context-free grammar is also describing a state machine (in this case a Pushdown automata). The best way to do this is probably by inspection of the state machine.

As a starting point, you could look into what a conflict is within parsers that make use of such automata.

Gian
@Gian Thanks! I will look those pages over. Also, would you mind explaining how literals in BNF work? It seems like they don't really do anything.
PFranchise
I'm not sure I understand. BNF just consists of terminal and non-terminal symbols. I believe things like having string literals lying around in grammars is just a consequence of nobody being very precise about what constitutes a symbol. If this is the thing you mean, then the way they work is that they mostly don't. They tend to be very fragile.
Gian