[RFC007] First step: AST representation
This is a draft implementation of the first step of RFC007: define the first AST representation, supposed to be output by the parser.
The whole RFC007 is a big chunk of work; we don't want to implement it all at once and make it the default. This PR creates a new module, which is only enabled under the bytecode-experimental feature, so that mainline Nickel is left unchanged, and we can experiment step by step on the side.
Bencher Report
| Branch | 2072/merge |
| Testbed | ubuntu-latest |
⚠️ WARNING: The following Measure does not have a Threshold. Without a Threshold, no Alerts will ever be generated!
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsCLI flag.
Click to view all benchmark results
| Benchmark | Latency | nanoseconds (ns) |
|---|---|---|
| fibonacci 10 | 📈 view plot ⚠️ NO THRESHOLD | 479,890.00 |
| foldl arrays 50 | 📈 view plot ⚠️ NO THRESHOLD | 1,681,600.00 |
| foldl arrays 500 | 📈 view plot ⚠️ NO THRESHOLD | 6,524,600.00 |
| foldr strings 50 | 📈 view plot ⚠️ NO THRESHOLD | 7,072,100.00 |
| foldr strings 500 | 📈 view plot ⚠️ NO THRESHOLD | 61,949,000.00 |
| generate normal 250 | 📈 view plot ⚠️ NO THRESHOLD | 43,954,000.00 |
| generate normal 50 | 📈 view plot ⚠️ NO THRESHOLD | 2,051,300.00 |
| generate normal unchecked 1000 | 📈 view plot ⚠️ NO THRESHOLD | 3,300,300.00 |
| generate normal unchecked 200 | 📈 view plot ⚠️ NO THRESHOLD | 745,310.00 |
| pidigits 100 | 📈 view plot ⚠️ NO THRESHOLD | 3,200,600.00 |
| pipe normal 20 | 📈 view plot ⚠️ NO THRESHOLD | 1,482,900.00 |
| pipe normal 200 | 📈 view plot ⚠️ NO THRESHOLD | 10,459,000.00 |
| product 30 | 📈 view plot ⚠️ NO THRESHOLD | 817,510.00 |
| scalar 10 | 📈 view plot ⚠️ NO THRESHOLD | 1,493,100.00 |
| sum 30 | 📈 view plot ⚠️ NO THRESHOLD | 815,220.00 |
For my understanding, do you actually intent the flat AST to be an output of the parser?
If I understood this correctly, there's no flat AST: just a tree AST and a bytecode format. This PR is the simplified tree AST produced by the parser. It's simplified compared to current nickel because it doesn't have to support evaluation.
Ah. That's the point I'd missed. Thanks @jneem .