A live-coding session demonstrating how to build a parser and interpreter for a Turing-complete language using NodeJS and CaffeineEight.
Any Turing-Complete language can, in principle, compute anything any other Turing-Complete language can. I use NodeJS and my parsing library CaffeineEight to not only explain what it means for a language to be Turing-Complete but also build the parser and interpreter in less than 60 minutes and 80 lines of code. This is powerful stuff!
Writing a toy programming language doesn't have to be difficult. With the right tools it can be easy and a useful exercise. At a minimum, it can be very educational. Languages define the boundaries of our thinking. Writing your own language, even if it's just for play, helps you think way outside the box. And who knows, your new-found language-writing skills can also come in handy the next time you need a custom DSL or have to parse something more complicated than regular expressions can handle.
This is my 3rd LiveCode. Unlike my previous LiveCoding videos, this one I did some prep for to make it more useful as a tutorial. My intention is to have most of my videos be live and raw, but sprinkle in these tutorials periodically, which are just more polished and focused. When I do, I'll be recording some of my prep, LiveCode style, for you to view if you want to see what happens behind the scenes.
This is all built on the JavaScript platform. It runs in NodeJS. I used CaffeineEight, a parsing tool I wrote which uses parsing-expression-grammars. I built CaffeineEight originally so I could write CaffeineScript, my language which lets you write JavaScript in less than 1/3 the code.
You can find the source materials and instructions on how to set up the tutorial to run on your computer in the CaffeineEight repository here:
github.com/caffeine-suite/caffeine-eight/tree/master/tutoria…
See how I prepped for this video:
youtube.com/watch?v=szm1Io5xww4&feature=youtu.be
Technologies: CaffeineEight, CaffeineScript, JavaScript / NodeJS (platform)
Tools: SublimeText, Xterm2
Links:
CaffeineScript.comgithub.com/caffeine-suite/caffeine-eight (CaffeineEight)
LiveCoding is about sharing real-world programming with an experienced programmer - me, Shane Brinkman-Davis. I'll be working on various open source projects, live, warts and all.
In association with GenUI.co - a brilliant software, design and product consulting company in Seattle I work with. Learn more: genui.co
…educational. Languages define the boundaries of our thinking. Writing your own language, even if it's just for play, helps you think way outside the box. And who knows, your new-found language-writing skills can also come in handy the next time you need a custom DSL or have to parse something more complicated than regular expressions can handle.
[video (edit: fixed link)…