gator
gator copied to clipboard
External Interpreter
We are using a simple in-house interpreter right now for Gator, which is getting really annoying to maintain. It would be much better to be able to invoke an interpreter from another language (I'm thinking JS or python).
There are two ways we could go about doing this
-
Write a translator from the TypedAST to the interpreting language, with operations you want to support having baked-in translations rather than function calls. This will be similar to how Ops is currently written, but using another language as a back-end rather than writing OCaml by hand
-
Write a library in Gator to mimic the target language, then write a small compiler module to match target language syntax. This should produce code that can be run directly in the interpreting language. I suspect this is harder and will run slower, but should scale better than (1).
Sorry to be the PL pedant, but if there's a translator from the AST to a different language (like Python), that's not an interpreter—it's a compiler. :smiley: And if there is already a working TypeScript compiler (#67), maybe that fulfills the same role?