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

Re: gnubol: Re: Magic tokens



The problem arises because both search and inspect use WHEN as a delimiteer.
Imagine a simpler version of the grammar:

%start statement

statement:
search_statement
|evaluate_statement
|display_statement
;

search_statement:
SEARCH (WHEN S statement)*
;

evaluate_statement:
EVALUATE (WHEN E statement)* (WHEN OTHER statement)?
;

display_statement:
DISPLAY literal
;

So parse this:

SEARCH
     WHEN S
          EVALUATE
                   WHEN OTHER
     WHEN S
          EVALUATE
                    WHEN E
                        DISPLAY "hello hello hello"
#

How do you tell who owns the WHENs with k=1 lookahead?

In the real language, maybe with k>1 lookahead you can work it out, as suggested
by the 'S' and 'E' which are meant to be grammar constructs that may be
distinguishable or may not, but not with k=1.

Once I have the parser running I can do some more practical experiments. To
repeat though, it is not a problem unless IBM has support for the conditional
forms of these verbs.

Tim Josling

RKRayhawk@aol.com wrote:

> SEARCH/EVALUATE/WHEN
>
> On this it may be useful for you to post the several variations you are
> trying (if easily isolated) and show us the 'problem' bison is having it each
> case.



--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.