|AST must for xlator? rramsey500NOSPAM@earthlink.net (Russ Ramsey) (2002-05-12)|
|Re: AST must for xlator? firstname.lastname@example.org (2002-05-17)|
|Re: AST must for xlator? email@example.com (James Powell) (2002-05-31)|
|Date:||17 May 2002 00:20:52 -0400|
|Posted-Date:||17 May 2002 00:20:51 EDT|
"Russ Ramsey" rramsey500NOSPAM@earthlink.net;
Date: 12 May 2002 00:06:35 -0400, wrote
I wrote Lex & Yacc code to parse SAS; now how do I output the
symbols into COBOL?
Assuming each statement of one equals only one statement of the
other. On the grammar rules actions can I just save to tree the
equivalent tokens and then print them out infix? Any examples out
there of the simplest data structure for this purpose?
Well, you may have a partly easy task ahead of you, and a partly
Your data declarations should be analogous in each syntax. And the
sequence of detailed fields should be comparable. So for the emission
of data declarations (perhaps merely copybooks) the tree walk should
be literally straight forward.
The procedures are another matter. SAS has built in algorithms. You
will need similar 'canned' routines: created and perfected independent
of your syntax rule achievements thus far. These will be a library of
callable routines or includable paragraphs or sections that you can
You will need major strategies to standardize this COBOL-side tool
To some extent then you will need tree walks that emit invocations of
these routines, and in other cases you will need to emit detail
executable COBOL logic to MOVE, COMPUTE (or just formulas, of course),
and to engage the many COBOL I/O facilities in a way comparable to the
Some of the I/O and some calculation may require you to do things back
up in the DIVISIONS above the PROCEDURE DIVISION.
COBOL compilation, since the earliest days, has involved the
equivalent of a lot of intermediate files that get merged. The 'fourth
generation' syntax of SAS will require you to emit into several
DIVISIONs at once with a subsequent merge, or to do multiple passes of
Return to the
Search the comp.compilers archives again.