I'm beginning to agree with Scott that LALR(1) isn't enough.

1) line field 1 of card field 1...
        vs.
2) line field 1 of card 1...
        vs.
3) line field 1 of first card...
        vs.
4) line field 1 of first card field...

These come from the lexical analyzer (flex) as:

LINE FIELD INTEGER OF CARD FIELD INTEGER
LINE FIELD INTEGER OF CARD INTEGER
LINE FIELD 1 OF FIRST CARD
LINE FIELD 1 OF FIRST CARD FIELD

The first question is if a shift or reduce is to be performed 
after "line field 1". "Field 1" is, by itself, a valid reference 
to a field. "of" could be the of in:
        LINE expr OF expr
Or, then again, it could be the OF to indicate we're going to be 
more specific about which field. For the examples:

(1) "field 1" should be reduced, OF is part of LINE.
(2) OF should be shifted
(3) OF should be shifted
(4) "field 1" should be reduced, OF is part of LINE.

I want to stress that the grammar (here) is not ambiguous; it 
just requires 3 or 4 tokens of lookahead, depending on how much 
the lexical analyzer is hacked. Maybe even 2 with a really large 
hack. But I don't see one to allow me to get down to LALR(1) and 
still be able to build an AST.

Also, what do you think of btyacc for situations like this?


_______________________________________________
Freecard-general mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freecard-general

Reply via email to