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.
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.
/* 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).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.