help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HyperTalk Grammar, Again


From: Anthony DeRobertis
Subject: HyperTalk Grammar, Again
Date: Sun, 20 Jan 2002 10:58:33 -0500

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?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]