It being my first ever "real" c program, I'm not quite there yet. Very curious to read more source code of small languages, preferably things that are implemented in one file only.
It being my first ever "real" c program, I'm not quite there yet. Very curious to read more source code of small languages, preferably things that are implemented in one file only.
https://github.com/munificent/mark-sweep
And an article I wrote about it:
http://journal.stuffwithstuff.com/2013/12/08/babys-first-gar...
This was the inspiration for uLisp's GC (http://www.ulisp.com/show?1AWG). :)
If you want a more full-featured but still small language in C, you could take a look at Wren:
FiDo, a tiny JIT compiler: https://github.com/JohnEarnest/Mako/blob/master/demos/FiDo.f...
A Logo interpreter: https://github.com/JohnEarnest/Mako/blob/master/demos/Loko/L...
A garbage collector used by a number of games and programs: https://github.com/JohnEarnest/Mako/blob/master/lib/Algorith...
A custom systems programming language targeting the VM (Java) https://github.com/JohnEarnest/Mako/tree/master/tools/Stroye...
http://johnearnest.github.io/Mako.js/?rom=Loko
Unfortunately some browsers have decided that backspace should navigate back, which makes typing at the Loko REPL rather awkward.
http://www.amazon.com/Compiling-Continuations-Andrew-W-Appel...
and Modern Compiler Implementation in ML:
https://www.cs.princeton.edu/~appel/modern/ml/
There's a certain kind of equivalence between continuations and SSA. Mostly, I bring that up because if you go down the rabbit hole of designing a compiler in C, you'll find talk of SSA, but continuations are somewhat advantageous for designing functional compilers. If you're just looking to design an interpreter, Ben Pierce's book Types and Programming Languages does a good job at showing how to put together a simple functional language both theoretically and practically:
[1] http://peter.michaux.ca/articles/scheme-from-scratch-introdu...
(Not that writing a lisp is a bad way to learn C of course!)
[1] "A Modern Implementation of the Common Lisp LOOP Macro", European Lisp Symposium https://www.youtube.com/watch?v=ZJr81DtSwUc
Later versions include GC, and bytecode compiler + VM.
Edit: I highly recommend SICP (dense, but elegant), and Matt Might's blog as resources.
A Racket client for the Arduino Service Interface Protocol (ASIP)