[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnubol: Re: Magic tokens
Tim, I'm going to play these straight. While I think IBM might very
well have permitted some nested constructs, I'd be very surprised if
thay did this one. They're lazier than you are. Letting SIZE
ERROR nest is actually a little easier than handling it, but this one
takes a lot of effort and I don't imagine anyone wants it. One case
that might fall out may be a WHEN after a WHEN OTHER, but I don't
want to do anything about it in general. Let the syntax errors fall
where they may.
If it's a challenge, of course, I could probably get through it with
lookahead, but I don't really see any reason to do it. My current
attitude probably makes my grammars for these verbs uninteresting, so
I won't inflict them on you.
What are you doing about illegal NEXT SENTENCE? I find those
particularly nasty, and I've had to go outside of syntax proper to
catch them.
Regards,
Mike
>>>>> "Tim" == Tim Josling <TIMJOSLING@prodigy.net>
>>>>> wrote the following on Mon, 06 Dec 1999 08:45:50 +1000
Tim> The problem arises because both search and inspect use WHEN as
Tim> a delimiteer. Imagine a simpler version of the grammar:
Tim> %start statement
Tim> statement: search_statement |evaluate_statement
Tim> |display_statement ;
Tim> search_statement: SEARCH (WHEN S statement)* ;
Tim> evaluate_statement: EVALUATE (WHEN E statement)*
Tim> (WHEN OTHER statement)? ;
Tim> display_statement: DISPLAY literal ;
Tim> So parse this:
SEARCH
WHEN S
EVALUATE
WHEN OTHER
WHEN S
EVALUATE
WHEN E
DISPLAY "hello hello hello"
Tim> How do you tell who owns the WHENs with k=1 lookahead?
Tim> In the real language, maybe with k>1 lookahead you can work it
Tim> out, as suggested by the 'S' and 'E' which are meant to be
Tim> grammar constructs that may be distinguishable or may not, but
Tim> not with k=1.
Tim> Once I have the parser running I can do some more practical
Tim> experiments. To repeat though, it is not a problem unless IBM
Tim> has support for the conditional forms of these verbs.
--
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.