O'Reilly logo

Metaprogramming Elixir by Chris McCord

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required