Hacker News new | ask | show | jobs
by crzwdjk 2789 days ago
Having tried to build a much simpler jankier version of the same thing, I agree that Rust is great for a) performance and b) making compilers for query languages. In particular, algebraic data types are great for representing syntax trees and matching is great for operating on them, with optimization represented as transformations from one tree to another. My compiler had a couple of two passes, one to parse the query into a parse tree and the other to do some type checking and name resolution. The execution engine operated on this second tree form, which was fast enough for my purposes.

I'm curious what your queries get compiled into and how you end up doing optimization on them: are they parse trees, or bytecode, or native code (is that what "JIT optimizations" refers to)?