I have written a compiler in Erlang that compiles source code in E language, which is a simplified C language, to 32-bit RISC-V (rv32im) machine code. And the generated machine code can run on a RISC-V MCU. (Tested on CH32V307)
The compiler is built with the help of leex
, yecc
and the powerful pattern matching of Erlang. I wrote the compiler in my spare time, it would be much harder or impossible if I didn’t choose Erlang.
I am not a compiler expert, some of the algorithms might be naive, but it can run on a real MCU and can do some useful things. So I can’t wait to share my happiness with other Erlang users.