Early (outdated) documentation attempt here:
https://docs.google.com/document/d/1DRN-tBIqhqVVyoHIDs7CMkduBFk-vqd_958ojeIBLHQ/edit
Notes from working with existing AST
- Blocks
- Inconsistent treatment of empty blocks
- (let [x 1]) has four environments of interest: before the let form, at x's initializer, after x is 1, and after the let form. For an empty block, there is no where to get an environment with x in the locals.
- Would be nice to have an explicit nil :constant node for empty blocks
- Synthetic blocks
- Would be a place to hang that :env
- Could disallow special forms other than 'do from having blocks. Change (let* [x 1] 2 3) to (let* [x 1] (do 2 3))
- let and letfn don't expose a :body-env, but try's catch does! would prefer explicit blocks nodes
- (conj (vec statements ret)) pattern spills into client code
- Inconsistent here too. Forcing children to vectors causes heap to fall over for cljs.core on my box
- Should not allow lazy structures to persist between passes
- Inconsistent treatment of empty blocks
- :children key duplication
- Detailed discussion here: http://dev.clojure.org/display/design/AST%2Bchildren (fold that into this page?)
- No root AST node type
- Need a place to hang top-level info. File names, source data, etc.
- loop yields :let op
- Shares a lot of implementation details, but are genuinely distinct ops
- Straight forward fix to add another op type and to call parameterized implementations
- Allows more flexibility in representing bindings
Labels: