Java AST investigations

Clone the java-ast repo on your machine. (You do not need to accept an assignment or fork it or anything like that, because you will not be handing in code. Just experiment!)

Import and run the project using either IntelliJ (the best tool for Java), VS Code (which you may already have), or the command line — your choice. Instructions are in the project’s README.

Try using different Java files as input, and study the AST output. There are some starting examples in the examples directory. Study the output from those files. Make small changes and study how the output changes. Try things that aren’t in those files. Experiment! Explore! Fool around!

If and only if you are looking for something more adventurous, study AstTransformer. It uses tree tranformations to take existing code and transform it into new code. Because it works on an AST instead of raw text, it’s guaranteed to produce results that are syntactically correct.

Post to Slack if you notice anything particularly fascinating or puzzling. It could be something really weird, or it could be something very simple but interesting (e.g. “I notice there are no parentheses or braces at all in the AST”).