Hacker News new | past | comments | ask | show | jobs | submit login

My dad, who was a minister by day and Forth hacker by night, got me into programming when I was a teenager, and Forth and x86 assembly were my first languages. I wrote a small self-hosting Forth compiler for 8086 DOS (https://github.com/benhoyt/third), a tiny 32-bit Forth operating system for the 386 (I guess you'd call it "bare metal" today). Incidentally, my brother used my Third compiler at his work for a few years to write test scripts for embedded systems.

I still love the simplicity of Forth, and the fact that you can get a full Forth system going in a few KB on a new microcontroller. I learned the basics of assemblers, bootstrapped compilers (though not parsers, because Forth doesn't need a "real" parser), recursion, how to implement control structures, various kinds of bytecode (called "threaded code" in the Forth world), linked lists, hash tables, and so on. I also dislike 3rd party dependencies to this day (Forth has a pretty extreme not-invented-here culture).

I was really intrigued by Factor when it came out (https://factorcode.org/), as a modern incarnation of Forth, but I never really used it. By that point I had a "real" programming job and was doing absurd things like writing CGI scripts in C, until I discovered Python in the early 2000's. I stuck with Python for many years and really liked it, though more recently I've moved to Go.

I learned a lot by playing with Forth as a teenager, and I'm really grateful for the language. It was an amazing way to start programming.




"Threaded code" is not quite the same as bytecode. Usually it's a sequence of subroutine addresses that are then dispatched to, a bit similar to how vtables are implemented in high-level languages. Other implementations are possible, but tokenized systems ala bytecode are only one of many possibilities, and not usually the most common. https://en.wikipedia.org/wiki/Threaded_code


Yep, you're right, thanks for the clarification. I was simplifying (never a good idea for a highly technical audience :-) because most people haven't heard of threaded code but have heard of bytecode. My Third compiler used direct threading.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: