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

gnubol: refmod again



Tim, I've been really slow on this, but I've finally had the
epiphany.  We have been regarding refmod as a part of a data
reference, but in reality it is a postfix operator.  It's a little
unusual in that it can be used on the lhs, but that's not unique.
PL/I calls such things pseudo-variables.

Notice that the language never requires a refmod, so we can consider
a reference without one to be a degenerate case which is the whole
string.  That means we can make a rule for refmod which does not
actually require the refmod component to be present.  Consider these
pccts rules.

identifier
	: DATA_NAME (qualifier)* { subscripts }
	;

qualifier
	: ( OF | IN ) DATA_NAME 
	;

subscripts
	: OPAREN (subscript)+ CPAREN
	;

subscript
	: (DATA_NAME ( qualifier )* { (PLUS_OP | MINUS_OP) integer } | integer) 
	;

refmod
	: identifier { OPAREN arith_expr COLON { arith_expr } CPAREN }
	;

What I have done here is promoted the refmod rule from being a
sub-rule of identifier to be a rule which has identifier as a
sub-rule.  The refmod part itself is optional, so what remains to be
done is to replace identifier references within the grammar to refmod
references wherever refmod is permitted.  It should be easier in
semantics, as well, if refmod is presented as an operator.  What do
you think?

Best regards,

Mike






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