Re: PRD parser problem: How to deal with mutiple linesby philcrow (Priest)
|on Jun 13, 2008 at 13:31 UTC||Need Help??|
This is about choices. From the examples, there are three possible section contents: single line description, description with a brace block, and blank. That leads to three productions (including blank which is not an <error>).
You could start that like:
Then define a description
Finally a statement
The key is to think: what are the choices for a valid description or statement or whatever? Each choice is an alternative. Each alternative is made of pieces which themselves might have choices.
p.s. Normal conventions of grammars have us use upper case on the left side of a rule only if we are defining a token. Other left sides, which are built from other things, are usually lower case.
The Gantry Web Framework Book is now available.