Monthly Archives: January 2014

Boostrapping a Forth in 46 lines of Moonscript code

There’s an article called Boostrapping a Forth in 40 lines of Lua code that’s been around since around 2007. It’s a great article and I’d highly recommend reading it. However, I only recently found it after some interest in Forth. This is the Forth outer interpreter in Lua from the above article reformatted a bit: eval = function (str) return assert(loadstring(str))() end subj = "" pos = 1 parsebypattern = function (pat) local capture, newpos = string.match(subj, pat, pos) if newpos then pos = newpos Continue reading →