June 2022
Intermediate to advanced
130 pages
2h 45m
English
The building block of the whole Elixir language is the AST. This concept is extremely powerful, and not one that every programming language supports. Building Elixir’s AST with Elixir data structures means the Elixir language and the tools it depends on can be built layer by layer, mostly in Elixir itself.
Every line of code you write has an underlying representation in the AST. Fortunately, it’s easy to see the representation of any line of code. Let’s see the AST for some primitive types:
| | iex> quote do "string" end |
| | "string" |
| | iex> quote do :atom end |
| | :atom |
| | iex> quote do [:list, :of, :atoms] end |
| | [:list, :of, :atoms] |
| | iex> quote do 1 end |
| | 1 |
| | iex> quote do {:one, 1} end |
| | {:one, ... |
Read now
Unlock full access