Appendix G. AST visitors
After reading chapter 9, you should have a general idea of what types of tasks compile-time metaprogramming can offer, how Groovy gets compiled into AST and eventually bytecode, and which tools you’ll need for further exploration. We’re all set to dig in and see some of the details of AST. This appendix focuses on walking and reading an AST. We’ll look at the options for code visitors and the implementation of a static analysis tool for Groovy.
The examples in chapter 9 are focused on writing new information into the AST of a class. Transformations give you the class and method nodes you need to work with as parameters. This is enough when you want to write AST. But things aren’t always so simple. Often, we need to read ...
Get Groovy in Action, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.