blob: 39340fe846ac01b5a731fbd1c17b28164246905a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
The Expr
========
[ block ] ⇐ A list of exprs.
│ ┌┘
│ │
[ expr ] ── [ lit ] ⇐ A literal value; "base case" for the tree.
│ │ ├── type
┌──┘ └──┐ └─ value
[ def ] [ call ]
│ │
├─ [target] ← id ├─ [target] ← id ⇐ An id is a pointer to another part of the tree.
└── [value] ← expr │ It also contains the flags used in the definition.
└──── [arg] ← expr
Example Expr Tree
=================
[ block ]
│
├─ [ def ]
│ │
│ ├─ [target] → hello
│ └── [value] → [ lit ]
│ ├── type → str
│ └─ value → Hello, World
├─ [ call ]
│ │
│ ├─ [target] → print
│ └──── [arg] → hello
...
|