June 20th, 2024

As you learn Forth, it learns from you (1981)

The Forth programming language is highlighted for its unique features like extensibility, speed, and efficiency. Contrasted with Basic, Forth's threaded code system and data handling methods make it versatile.

Read original articleLink Icon
As you learn Forth, it learns from you (1981)

The article discusses the unique characteristics of the Forth programming language, contrasting it with Basic. Forth allows programmers to extend its vocabulary by defining new words in terms of existing ones, resembling human knowledge. Unlike Basic, Forth is both an interpreter and a compiler, using a compact list of subroutines known as "Threaded code" for efficient execution. The article highlights Forth's speed and extensibility, making it suitable for applications like ROMable code for testing or process control. It also explains the fundamental concepts of Forth, such as handling data on a datastack and using reverse Polish notation for arithmetic operations. The article provides examples of Forth syntax, including defining new words, constants, and variables. Additionally, it mentions the development of a Forth version for North Star DOS, emphasizing the efficiency and flexibility of Forth programming. The author's experience in creating a Forth implementation optimized for Z-80 processors is also detailed, showcasing the power and speed advantages of Forth over Basic in microcomputer applications.

Related

Smalltalk syntax in 7 minutes [video]

Smalltalk syntax in 7 minutes [video]

The YouTube video explains Smalltalk syntax, emphasizing readability and message-based object interaction. It covers keywords, arrays, closures, and method execution in Pharo Smalltalk, providing a practical example and additional learning resources.

F (2006)

F (2006)

F is a functional concatenative language with K3 list operations and Joy's dip combinator. It enforces one-time assignment, supports floating-point and symbolic datatypes, and emphasizes function-valence and -charge theories. The language is purely functional, prohibiting side-effects and reassignment, with various primitives for arithmetic, logic, and list operations. F also provides interactive commands for debugging and manipulation, focusing on simplicity, efficiency, and functional programming paradigms.

Trealla Prolog: Compact and efficient Prolog interpreter

Trealla Prolog: Compact and efficient Prolog interpreter

Trealla Prolog is a compact interpreter written in C, compliant with ISO Prolog. It supports unbounded integers, UTF-8 atoms, efficient strings, and runs on Linux, Android, and WebAssembly. It offers C integration, SQLite access, concurrency features, and experimental functionalities. The project is open source under the MIT license.

Optimizing the Roc parser/compiler with data-oriented design

Optimizing the Roc parser/compiler with data-oriented design

The blog post explores optimizing a parser/compiler with data-oriented design (DoD), comparing Array of Structs and Struct of Arrays for improved performance through memory efficiency and cache utilization. Restructuring data in the Roc compiler showcases enhanced efficiency and performance gains.

Gren 0.4: New Foundations

Gren 0.4: New Foundations

Gren 0.4 updates its functional language with enhanced core packages, a new compiler, revamped FileSystem API, improved functions, and a community shift to Discord. These updates aim to boost usability and community engagement.

Link Icon 8 comments
By @asguy - 4 months
Programming Forth caused the most massive change in my programming mindset (the LSD of programming languages). Even more so than Lisp. Thinking of the rapid rise of the base language to the problem domain (i.e. it's a DSL construction kit) opened my eyes to how to design useful and extensible APIs.

https://thinking-forth.sourceforge.net is worth reading, even if you have no desire to ever program any Forth.

By @detourdog - 4 months
Here is a link to the byte magazine issue that inspired the above article. https://archive.org/details/byte-magazine-1980-08/page/n2/mo...
By @aquariusDue - 4 months
For people interested in Forth I think this is a nice intro: https://ratfactor.com/forth/the_programming_language_that_wr...
By @rhelz - 4 months
When I read old articles like this, I start wondering what the story was behind all those companies mentioned. Stackworks Forth, Alan Ashley Assembler. You almost never hear of a company which is still around.

Was it actually possible, back then, to make a living selling Forth for CP/M computers? Or Assemblers? Did Stackworks have an office, with a jaded-looking middle-aged secretary who put out her cigarettes in an ashtray on her desk, before she picked up when the phone rang? A glad-handling salesman who came back to the office every few weeks before going out to sell?

I don't think it has been possible to sell a compiler which isn't a loss-leader in a bundle for what, 30 years?

Or were these side hustles? Alan Ashley, was his day job being a math teacher or something, and he did this to round out his budget?

The industry was a heck of a lot smaller back then, but these old articles mention way more different companies. Seems like before all these behemoth monopolies there was a lot more air to breathe.

By @ralphc - 4 months
I'm a vintage computer collector and the Jupiter Ace would be the holy grail of my collection. Has anyone seen one in real life?
By @deterministic - 4 months
Doing the opposite works for me.

I always start out defining the ideal API I want to solve a problem and then solve the problem using the not-yet-implemented API. I then implement the API recursively by adding lower level API’s that makes it easy to solve the higher level API problem. And most of the time I already have a lower level API from a previous project I can easily reuse and perhaps expand.

So I don’t start with the database moving towards the biz logic. I start with the biz logic moving towards the DB (if needed). It works really well.

I think this is similar to how experienced Lisp developers work. Starting out defining a new “language” (a bunch of functions) that makes it easy to solve the problem and then recursively implementing it. However I work in C++ and Typescript not Lisp.

By @simplify - 4 months
Are there any Forth variants that have static typing? Or more generally, are there any interesting type systems that target stack-based machines?