Evan Lavelle wrote:
Prolog
: FirstPrologList
| SecondPrologList
| FirstPrologList SecondPrologList
;
I missed the case of no prolog at all, but this has no conflicts:
Prolog
: /* nothing */
| FirstPrologList
| SecondPrologList
| FirstPrologList SecondPrologList
;
Evan
___
Root: Prolog
Prolog: FirstProlog SecondProlog
FirstProlog: /* empty */
| FirstProlog A
SecondProlog: /* empty */
| SecondProlog B
A: DECLARE FOO
B: DECLARE BAR
How about this:
Root: Prolog;
Prolog
: FirstPrologList
| SecondPrologList
| FirstPrologList SecondPrologList
;
Fir
On Wednesday 30 May 2007 12:55, Tim Van Holder wrote:
> Frans Englich wrote:
> > The intent of the grammar is to enforce that declarations appear in a
> > certain order(FirstProlog, SecondProlog), that the declarations are
> > optional, and they take the form of "declare ".
> >
> > This is somethin
Frans Englich wrote:
> The intent of the grammar is to enforce that declarations appear in a certain
> order(FirstProlog, SecondProlog), that the declarations are optional, and
> they take the form of "declare ".
>
> This is something that naturally leads to a shift/reduce conflict. As far as
>
See attached grammar. Its essence is this:
-
%token DECLARE
%token FOO
%token BAR
Root: Prolog
Prolog: FirstProlog SecondProlog
FirstProlog: /* empty */
| FirstProlog A
SecondProlog: /* empty */
| SecondProlog B
A: DECLARE FOO
B: DECLARE BAR
--