3 ms·
Not author, but I made the experience of writing a compiler, linker and assembler for a little programable ASIC. We did it in CL, because we had only 1 month.
by f1shy 1y ago
Not author, but I made the experience of writing a compiler, linker and assembler for a little programable ASIC.
We did it in CL, because we had only 1 month. The big advantage of a lisp for a compiler, is that you don’t need to make a parser: if you accept to follow lisp syntax, you can reuse the reader.
For making the linker is helped to have all in structs and lists structures. Each compiled piece of code was a list with actual binary code, where it had prepended the information as symbol name, pointers to where to change for relocation, etc.
The dynamic typing (sorry if I’m pedantic, but lisp is typed, even strong typed, but dynamic) played in favor. As a matter of fact, after we did 90% of the work we decided to change the type of some parts of the structures, it was almost no work. Had it been a static typed language, it would had been a MAJOR rewrite.
The fact that CL can also be static typed helped with performance, as for some thing we forced long int.