The Abstract Syntax Tree—Demystified

It’s time to explore the AST in depth to learn the different ways your source code is represented. You might be tempted to jump in and start writing macros at this point, but truly understanding the AST is essential as you get into advanced metaprogramming. Once we uncover the nuances, you’ll find your Elixir code is much closer to the AST than you might have imagined. This revelation will change the way you think about solving problems and drive your macro design decisions going forward. After reviewing the finer details of the AST, you’ll be ready to begin the metaprogramming exercises. So hang in there. You’ll be creating new language features before you know it.

The Structure of the AST

Every expression ...

Get Metaprogramming Elixir 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.