Hacker News new | past | comments | ask | show | jobs | submit login

Nice. This is a really ambitious project for just 4 contributors (and one that looks like they did most of the work). I'm curious why ASM and not LLVM?

Edit (comment above unaltered): I got down voted by someone which tells me I missed an obvious answer to my question. Did I miss something?

I've noticed a lot of compiler projects lately tend to default to LLVM, I'm curious of the strengths and weaknesses of LLVM vs ASM since the author here chose to compile to ASM.




My impression (as someone working on a compiler of my own, using LLVM), is that while you get a lot out of building on LLVM (portability across platforms, a collection of "free" optimizations, and a well defined low-level IR), it comes at the cost of a huge toolchain (takes about 5-10 minutes to compile from scratch on my laptop), and it is not stable across releases (the extent to which you are affected depends on the features your compiler depends on though). I think for toy projects it is probably more interesting to write the code gen yourself; and for projects focused on a specific platform, it is perhaps desirable to handle it yourself. Some people probably just don't want the dependency. My perspective is that I don't want to reinvent the work on cross platform support, or the optimization passes, and would rather take advantage of those efforts by depending on LLVM. I don't know that this makes sense for this project though.


LLVM is big, heavy, complicated, powerful. Kind of against the spirit of writing a lightweight C compiler. On the other hand, an x86 assembler can be easily implemented by one person and requires minimal cpu and memory resources.


Yeah, a fifth name appears in the macos branch. :) Not sure if github will show the name when macos is merged into master.

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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: