[antlr-interest] Token Stream vs. AST
Andy Tripp
antlr at jazillian.com
Fri Oct 13 10:27:55 PDT 2006
Oliver Wong wrote:
>From: antlr-interest-bounces at antlr.org
>[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Andy Tripp
>
>
>>I'd say about half of my C-to-Java rules are reused in COBOL-to-Java.
>>
>>
>
> This surprises me a lot. Can you elaborate on this? Surely stuff
>like "strcpy(a,b) -> a = b" couldn't be re-used. What *could* be
>reused?
>
> - Oliver
>
>
After most of the COBOL-specific rules/phases have fired, the code looks
pretty Java-like.
Some of the common rules:
remove gotos
rename files, vars, methods,
simplifications of various if/else if constructs
adding exception handling
checking for cases where javac will complain about "loss of precision".
making things into cleasses, adding imports, etc.
restoring comments
You're right, though, looking at it closely now, I'd say only maybe 20%
of the
C-to-Java rules are reused in COBOL-to-Java.
Andy
More information about the antlr-interest
mailing list