[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnubol: Record delimiter clause and parse order
Matthew,
I have printed this out and I will review it shortly. OK I have
actually looked at it. See below.
Tim Josling
Matthew Vanecek wrote:
> ...
> Just wanted to make sure I'm on the right track here. Here's what I'v
> got in the parser, so far. Needs much more, etc, etc, and a few more
> clauses. Before I get to far, the specs describe 3 or 4 formats (4 with
> the SORT file). Do we want to use 3/4 different select_* clauses, or
> roll them all into one?
Whatever is simpler and requires least code and generates good
error messages. From a vantage point of ignorance I would try do
it all in one and then validate using the parse tree, but you are
in a better position.
> Making separate parse rules for the different
> formats might actually be better, and easier to maintain, and easier to
> parse--options specific to a format could be shunted off into a
> specialized rule. At least, it'd be easier to see how it's *supposed*
> to parse a given input. ;)
>
Your call.
> The answer to the above question will determine somewhat where I go from
> here. I don't mind making unilateral decisions, but a consensus of
> opinions would be nice. I could do the parse rules for all 4 formats,
> if y'all would like...
>
Good idea as a lot of it is the same. The XP principle is
usuallly to build as you need. But it would be OK provided you
cover the unimplemented bits with RSN;s.
---------------
I would like to stick to the principle that _OPT is a separate
rule that just has X or nothing
X-OPT:
/* nil*/
|X
;
Similarly for repetitions
X-REP:
X
|X-REP X
;
I found this a lot simpler and people also commented that it
helped to understand the grammar.
You will find I think below that you get a lot of RR conflicts
because of the /* nil */ productions all conflict with each
other. The scheme above really helps a lot fo avoid this and to
make it easier to diagnose. Eg the rule below could keep on
reducing nothing forever.
It might be a good idea to create a little toy grammar and play
around with that.
Generally it is good however.
Regards,
Tim Josling
> select_sub_clause_rep_opt:
> /* empty */
> | select_sub_clause_rep_opt select_sub_clause
> | select_sub_clause
> ;
--
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.