[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnubol: Re: Magic tokens
Let me quote some material that went back and forth enough I don't know who
said what, but it is important. Then if you will consider my comment below.
In a message dated 12/4/99 9:41:38 PM EST, mck@tivoli.mv.com writes:
<< >>>> "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.
>>
At any given time we need competition between
A)
simple unterminated arithmetic statement
simple explicitly terminated arithmetic statement
sticky arithmetic with a conditional unterminated (A.3)
arithmetic with a conditional terminated (thus no longer sticky) (A.4)
B)
sticky arithmetic with both conditional branches yet unterminated
arithmetic with both conditional branches terminated (thus nolonger sticky)
(B.2)
The type B statements have blocks hanging on the first conditional that by
definiton ended
with the commencement of an arithmetic, that is how the second branch of the
conditional shifted on and made them category B. If the block that hangs on
the first conditional branch does not have arithmetics, it can not be sticky
and can not lead into the alternate clause. This can happen if the block has
arithmetics that are closed up with explicit scope terminators or has
arithmetics that are reduced by a subsequent verb (simple arithmetic
imperatives).
Thus the inner blocks of type B above are distinct in kind, they must end
with the leading porting of an arithmetic statement by definition, or they
can not relate to a continuation hunted for with a type B rule.
Consequently type A and type B rules only competing in the sense that the
competition is against the outer portion of type B rules. The inner rule of
type B rules never reduces if the block does not end with an arithmetic that
could be a candidate for the shift on of the alternate conditional. That
difference actually helps eliminate some conflict.
The inner rules never look for a type A.3 for example, yet must allow closure
and reduction of type A.4 anywhere in the inner block accept the end of the
inner block. And harsh as it seems the inner block must also allow for
reduction of type B.2 anywhere in the inner block accept the end of the inner
block.
All of this applies to the other conditionals as well.
I think life is complicated by permitting or planning for transposition of
the alternate conditionals. Ditto the other conditionals.
The inner blocks must be specified distinctly for each alternating
conditional verb.
Bob Rayhawk
--
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.