Writing compiler passes in meander #212
bsless
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Because, why not?
I don't remember how I got to it but this talk inspired me to try to apply meander to tools.analyzer's output AST. Like Haskell's Core it has a small set of primitives and I thought the approach of graph reduction / term rewriting is a good fit for meander.
The first case I tried to tackle was beta reduction.
Formally:
(\x -> B) E
->B[x/E]
(replace all occurrences ofx
withE
)In Clojure we can break the problem in two, similarly to how Haskell's compiler does:
And now in meander:
Next step - constant and copy propagation!
Beta Was this translation helpful? Give feedback.
All reactions