Hey guys, I've got a fairly basic math language I'...
# compiler
g
Hey guys, I've got a fairly basic math language I've expressed with antlr, it works and runs, but now I want to do some transcoding into a lisp-like language (specifically, my custom math language that supports things like
x*y^z + cos(f)
I want to translated into smt-lib2). I've read the compilers book in school and have used ANTLR professionally for some time, and I can probably hack this out with an antlr visitor and creating classes as the occur to me along with a good whack of string mangling, but I'm willing to bet somebody smarter than me has some nice compiler/code-generator tutorials/tools that would make my life a fair bit easier. Has anybody here done something similar and have some suggested reading?
r
Hi @groostav, I have done something similar Kotlin IR -> Lisp + SMTLIB grammars for a different project unrelated to Arrow. Since you start with a base grammar for your language and at some point you hit Z3 or similar I’d recommend to look at the K framework https://github.com/kframework/k Seems similar to the toolchain needed for what you are doing. We considered using K for our project but ended up using Haskell Liquid Fixpoint library because our problem was around solving constrains and not so much about the lisp. A Lisp was used for a human readable serialization format.