May 21st, 2012

beartato phd

(no subject)

Jonesforth is a very small forth interpreter written in about ~2k lines of x86 asm and ~2k lines of forth. The asm is actually overwhelmingly comments, with lovingly drawn ascii-art memory diagrams. It's a wonderful piece of literate programming.

You only really need the two files jonesforth.S and jonesforth.f, and then you do
$ gcc -m32 -nostdlib -static -Wl,--build-id=none -o jonesforth jonesforth.S
$ cat jonesforth.f - | ./jonesforth 
and you're good to go. Try typing
2 3 + .
and you should get [SPOILER WARNING!] 5.

The instructions in jonesforth.S itself say to also include the flag "-Wl,-Ttext,0" but when I do this, I get "Killed" immediately upon running ./jonesforth. Even when I gdb and breakpoint at _start. Anybody know why? Does this have to do with address space randomization or something?