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

Re: gnubol: Re: Magic tokens



>>>>> "Mike" == Michael McKernan <mck@tivoli.mv.com>
>>>>> wrote the following on Sat, 04 Dec 1999 21:23:50 -0500

  Mike> Tim, I don't know if this translates to bison very well, but
  Mike> I am thinking along these lines.

add_imperative
	: add_common { size_err end_add | end_add }
	;
add_stmt
	: add_common { size_err } { end_add }
	;
add_common
	: ADD 
	  ( CORR identifier TO identifier { ROUNDED }
	  |  ( identifier | NUMERIC_LITERAL )+
	     ( giving_phrase   	
	     ! TO ( identifier | NUMERIC_LITERAL ) giving_phrase
	     | TO ( identifier { ROUNDED } )+
	     )
	  )
	;

  Mike> A greedy parser will grab the size error for the appropriate
  Mike> verb.  (You'll remember that {} means optional.)

Well, now that I look at it, it may be a reduce/reduce conflict since
both rules are capable of deriving the same string.  Well, FWIW.



--
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.