11 karma · joined October 14, 2017
- additional 64-bit types will need additional code for type checks and conversions, switch, etc
- new or improved code generator is needed (ideally, 64-bit non-pointer types should also be supported in 32-bit programs, possibly as register pairs)
- new object and executable formats to handle
- possibly new ABIs to support (pushing arguments onto the stack and never bothering to align the stack pointer onto a multiple of 8 or 16 boundary is kinda easy, it's pretty much free)
And the above work hasn't been done.
I wanted something small and easily self-hosting. A compiler on a floppy (as in old times). I hope you guys know what floppies are. :)
smlrc.c runs in 96KB on a PIC32 MIPS microcontroller.
LLVM is big and if I don't implement enough of the language (and I hear LLVM is s written in C++, not C), I can't recompile LLVM.
I can write an assembler. Or I can use FASM, which is self-hosting, if I can't compile NASM or YASM.
IOW, it looks like the hardest work may still be up to you, but now you're dependent on external tools and self-hosting has become a bit questionable/problematic (you'd want those tools to be compiled by your compiler as well, right?).
Parsing tokens, OTOH, isn't a big deal. You don't need heavy artillery for them.
IOW, if you haven't had lots of experience with those tools or compiler creation already, you may not gain much from using them for the first time. If you have, you may reuse your experience and possibly even code.