Getting started with adding a backend for Rehp for a new language.
Let me know where you hit friction with these instructions and I'll clarify.
- Clone rehp
grep -r php .
to see various references to PHP. That shows you what was done to extend the compiler to add a new backend. You will be doing something very similar. In general, the best way to get started is to copy/paste everything that was done for PHP, to add your new backend.- Check out the file
compiler/lib/rehp.re
This is the new intermediate representation that was added to the jsoo compiler. Rehp uses the bytecode disassembler from jsoo, and instead of turning it into js, it turns it into this other intermediate representation called "Rehp"- which is defined by
compiler/lib/rehp.re`. - Add your backend to
compiler/lib/backend.ml/i
including info about the file extension. - Add a new file
compiler/lib/YourLang.re
, which can start out as a copy of thecompiler/lib/php.re
file. This represents the