Julia represents the source code of any runnable program as a tree structure. This is called an abstract syntax tree (AST). It is referred to as abstract as the tree only captures the structure of the code rather than the real syntax.Â
For example, the expression x + y can be represented with a tree where the parent node identifies itself as a function call and the child nodes include the operator function + and the x and y arguments. The following is an implementation of this:
The slightly more complex expression x + 2y + 1 would look like the following diagram. While it was written with two addition operators, the expression is parsed into a single function call to the + function, for which it takes three arguments—x, 2y, and 1. Because 2y is itself an expression, it can be seen as a subtree...