[antlr-interest] JavaEmitter - treewalker version

Andy Tripp atripp at comcast.net
Mon Dec 20 16:39:37 PST 2004


(First Real Post!)

Terence,

I finally got around to trying out your treewalker approach
to outputting a Java AST. A few comments:

* It might be nice to rename "java.tree.g" to "java.treeoutput.g"
or something to avoid confusion with the "standard" java.tree.g
that comes with ANTLR.


* Need to remove "package templates" and "import com.jguru.util.st.*" from
header.

* 2d array declaration produces error: "int[][] a = new int[1][2];"

* A few minor adjustments to the output would be nice:

    case contents are enclosed by redundant curly braces
    extra space before ":" in case statement
    blank line needed between "imports" and class definition.
    extra space after class name
    extra space before brackets within type: "String [] s;"
    extra space after type in declaration: "String  s";
    extra space before parens: "new java.util.Stack ()"
    extra newline inside for:
        for (int i = 0;
        i<a.length;i++) {
    could use more spaces in assignment and within expressions:
        "tokenNames[POST_INC]="++";
    blank line needed between methods

* A main() method to show usage also would be nice.

Andy



More information about the antlr-interest mailing list