Hi Everyone! I just wrote my first compiler!
- single pass, recursive descent, direct emission
- generates REL ELF binaries, runnable using ESP-IDF elf_loader
- very basic features only, just enough for self-hosting
- treats the Xtensa CPU as a stack machine for simplicity, no register allocation / window usage
- compilable on Mac, probably also Linux, can cross-compile for esp32 there
- wrote for fun / cyberdeck project
Sample output from esp32:
xcc700.elf xcc700.c -o /d/cc.elf
[ xcc700 ] BUILD COMPLETED > OK
> IN : 700 Lines / 7977 Tokens
> SYM : 69 Funcs / 91 Globals
> REL : 152 Literals / 1027 Patches
> MEM : 1041 B .rodata / 17120 B .bss
> OUT : 27735 B .text / 33300 B ELF
[ 40 ms ] >> 17500 Lines/sec <<
My best hope is that some fork might grow into a unique nice language tailored to the esp32 platform. I think it is underrated in userland hobby projects.