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

[GNU-COBOL] Problem in using yacc to parse COBOL grammar




Recently I sought some advice from Vadim Maslov of Syber Systems, so I
could benefit from his expertise, and resolve the issue of whether yacc can
handle COBOL grammar. 


There appears to be a problem in using bison(yacc) to parse COBOL grammar.


Here is an example of where yacc will fail.


Vadim Maslov <vadik@siber.com> writes;
>
>OK, here's one example:
>
>PERFORM A OF B TIMES ... END-PERFORM 
>vs 
>PERFORM A OF B MOVE X TO Y
>
>After we read tokens PERFORM A OF B, 
>we need to see either TIMES or verb token
>to determine how to treat PERFORM statement
>and what termination it will have.
>
>In the 1st case A OF B is paragraph name,
>in the 2nd case A OF B is data item name.
>
>So here it requires lookahead of 3.
>Since number of levels of OF/IN qualifier is limited by 50,
>potentially lookahead of 50 is reuiqred.
>BtYacc can do infinite lookaheads, so it can get thru here,
>while tools that can do lookaheads of 1 or even 2 or 3 will fail.


Any comments, suggestions, work around ?


If no adequate solution is found, I think btyacc should be used instead of
yacc(bison).



David


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