I have this page on my "TODO" list. What is your opinion about it? I see already that you are recommending it but maybe you can give some more details. Thanks in advance.
It starts you from scratch and I'd say it's well done, maybe even be overdone for Lisp. But you get a good introduction to the essentials of language implementation for more complicated languages.
Shameless self-promotion: I wrote a Lisp interpreter in a single assembly file for Raspberry Pi. It also starts from scratch at an even lower level, to the point of ignoring standard libraries.
Great work on this! I've not touched ASM in nearly 20 years (I first learnt C and then a bit of ASM to crack software using Softice!)
This really makes me want to blow the dust off the RaspberryPi (we all bought one and never used it: admit it) and get this up and running, just to see it working.
Skimming through it and seeing stuff like this doesn't leave much headroom for a high opinion, at least from a hard-line Lisp and C expert point of view:
/* excerpt from builtin_op function */
while (a->count > 0) {
/* Pop the next element */
lval* y = lval_pop(a, 0);
if (strcmp(op, "+") == 0) { x->num += y->num; }
if (strcmp(op, "-") == 0) { x->num -= y->num; }
if (strcmp(op, "*") == 0) { x->num *= y->num; }
if (strcmp(op, "/") == 0) {
if (y->num == 0) {
lval_del(x); lval_del(y);
x = lval_err("Division By Zero!"); break;
}
x->num /= y->num;
}
lval_del(y);
}
For people who are newbies to programming and newbies to C, this sort of book can provide stimulating activities and motivation. Ultimately they will probably be unsatisfied with their results (but then nobody is ever satisfied with their results no matter what, if they are newbies in programming and C, struggling to make something).
I worked through the book while I was in school as a way to prepare myself for a C-programming heavy course (OS) that I was scheduled to take later in the semester. I liked the book - its quite intense but you do end up learning quite a bit. I also picked up interesting tidbits on Lisp so that's quite welcoming.
One thing that you might be interested in knowing about is that this book uses a few libraries which means you don't end up writing everything from scratch. For example, in the chapter on parsing, the grammar is implemented using a library called MPC (https://github.com/orangeduck/mpc) written by the author himself.
I didn't quite reach till the very end so didn't have a chance to implement Macros (the author does mention them in Chapter 16), so if that's something you can very keen on implementing then you might have to look someplace else.
Shameless self-promotion: I wrote a Lisp interpreter in a single assembly file for Raspberry Pi. It also starts from scratch at an even lower level, to the point of ignoring standard libraries.
https://github.com/marcpaq/arpilisp
I was inspired by jonesforth, which, if you haven't read it, is a beautiful piece of work.