about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-03-20 15:02:55 +0000
committerbors <bors@rust-lang.org>2015-03-20 15:02:55 +0000
commitecdf792d1dda479d04781e5750737aa6cc574119 (patch)
treee3b7bca932796a1dcc78ac9cf0e5d030f76365b9 /src
parentcbc660bd1c200e672e91bfdbb83e57e6e057314c (diff)
parentaf09763cc15b31b1f1deeffe77324df97e03113c (diff)
downloadrust-ecdf792d1dda479d04781e5750737aa6cc574119.tar.gz
rust-ecdf792d1dda479d04781e5750737aa6cc574119.zip
Auto merge of #23537 - steveklabnik:gh22551, r=alexcrichton
Fixes #22551

('grammar' wasn't really used in the chapter at all)
Diffstat (limited to 'src')
-rw-r--r--src/doc/trpl/advanced-macros.md8
-rw-r--r--src/doc/trpl/glossary.md23
2 files changed, 28 insertions, 3 deletions
diff --git a/src/doc/trpl/advanced-macros.md b/src/doc/trpl/advanced-macros.md
index a226e4d0bf9..86279f7f1a1 100644
--- a/src/doc/trpl/advanced-macros.md
+++ b/src/doc/trpl/advanced-macros.md
@@ -6,9 +6,11 @@ off.
 # Syntactic requirements
 
 Even when Rust code contains un-expanded macros, it can be parsed as a full
-syntax tree. This property can be very useful for editors and other tools that
-process code. It also has a few consequences for the design of Rust's macro
-system.
+[syntax tree][ast]. This property can be very useful for editors and other
+tools that process code. It also has a few consequences for the design of
+Rust's macro system.
+
+[ast]: glossary.html#abstract-syntax-tree
 
 One consequence is that Rust must determine, when it parses a macro invocation,
 whether the macro stands in for
diff --git a/src/doc/trpl/glossary.md b/src/doc/trpl/glossary.md
index 156f3374867..97898324847 100644
--- a/src/doc/trpl/glossary.md
+++ b/src/doc/trpl/glossary.md
@@ -14,3 +14,26 @@ let z = (8, 2, 6);
 ```
 
 In the example above `x` and `y` have arity 2. `z` has arity 3.
+
+### Abstract Syntax Tree
+
+When a compiler is compiling your program, it does a number of different
+things. One of the things that it does is turn the text of your program into an
+'abstract syntax tree,' or 'AST.' This tree is a representation of the
+structure of your program. For example, `2 + 3` can be turned into a tree:
+
+```text
+  +
+ / \
+2   3
+```
+
+And `2 + (3 * 4)` would look like this:
+
+```text
+  +
+ / \
+2   *
+   / \
+  3   4
+```