Anna's Articles

Teaching Kids Forth

2026-04-14

Forth is uncommonly used to teach programming to kids. Scripting languages like Python and visual environments like Scratch are far more popular options. But when I got the opportunity to introduce middle and high school students to programming, I chose the stack-oriented concatenative language from 1970.

I was ecstatic about this opportunity. I'm passionate about giving people just a bit more control over the potential locked up in the devices they carry with them every day. When people know more about computers in general and about making their own software in particular, whole worlds open up. This gave me the chance to pry the door to that world open for people who likely would have never discovered it otherwise.

While I had taught people programming to individuals previously, this was my first experience teaching in a classroom environment. I went from knowing next to nothing about teaching to designing my own curriculum, including lesson plans, curriculum, and a digital learning environment.

Why Forth?

I could have chose to teach any programming language. I could have chosen Python or Scratch, but I wanted to explore a path less commonly chosen and maybe find some gems that are otherwise overlooked.

Because of the limited amount of time I had to teach, and the fact that I wanted to teach more fundamental concepts, I wanted to avoid teaching syntax. While Python makes sense as pseudocode to someone who understands what code is, it is still nearly incomprehensible to new learners, which I discovered in previous years teaching programming one-on-one.

I decided I wanted to either teach Forth or Haskell. Forth was appealing because it's a concatenative language. You write the instructions and it simply executes everything in order. As long as you understand what a stack is you can write Forth programs.

Haskell was appealing because it integrates well with how students are already taught about how to think about variables and functions in mathematics. I've seen too many new programmers get confused that in programming variables are boxes that can contain any value instead of the algebraic definitions they've learned in math class.

I ended up choosing Forth for two reasons. First, it was easier to integrate into a custom learning environment I could prepare for the students. Second, I figured procedural programming would be easier to conceptualize than functional programming for the in-class final demo.

As a side benefit, the use of a semi-obscure language like Forth ensured that even students who did programming before would learn something from the experience without alienating new learners.

Designing the Cirriculum

When designing the cirriculum, I knew I would be pressed for time. I had 12 sessions, once per week, each one hour long. I also knew it wasn't likely they were going to complete much homework if I had assigned it considering they had lives outside of my class.

The tangible learning outcome was for students to create their own art in the Forth environment. This could be anything from a simple drawing to an animation to a game. I wanted them to have something they could see and keep with them after the course had ended. It can be discouraging to learn a lot of technical details on a topic and feel like you had little to show for it.

It was important that the students could run the code the wrote on their own computers. It was doubly important that they didn't have to download or install anything for it to work, since students could be using a variety of operating systems—some of which may not be capable of installing third party software.

My first choice for our learning environment involved writing my own Forth from scratch in Rust and embedding it in our course website with WASM. Unfortunately, ironing out the bugs in my implementation took longer than I intended. So I switched gears and chose to use Nick Morgan's Easy Forth as both our cirriculum and Forth interpreter.

For each lesson, I created slides and a lesson plan which I uploaded to an online portal which the students could access. This included a copy of Easy Forth.

Introducing Computing

It was then time to start going over the actual lessons with the students. I plugged my laptop into the large TV to display my slides and began the introductory lecture.

We started by going over the history of computing and what a computer is. One of my favorite parts was showing them various devices and asking them if they were computers. They were initially perplexed when I showed them an abacus and told them it was a computer. Our working definition was, "Anything that calculates numbers." They soon realized that almost anything could be a computer, including themselves!

This is a computer! A simple abacus

After breaking their idea of what a computer could be and setting their expectations, I began to teach them about Forth in particular. I explained the places it's used and its embedded applications.

Once the fundamentals were down, the next step was to move to our cirriculum and dive into Forth. However, Easy Forth assumes its readers know at least one programming language and know about stack-based data structures. That was far from the case here. It was my job to bridge that gap.

What is a Stack?

Before even touching our computers, we had to begin to visualize the fundamental data structure underlying Forth: the data stack.

Anyone with a rudimentary computer science education will understand what a data stack is and its operations, but normally that's not the first thing introduced to new learners.

So I used plates.

In Forth, when you type numbers surrounded by whitespace, they are added to the stack. For example, this adds 1, 2, and 3 to the data stack:

1 2 3

If you were to print these numbers, such as with . . ., the outputted text would be 3 2 1. This is because a stack is a Last-In First-Out data structure. You can either "push" an item onto a stack (put it on top), or pop an item off a stack (pull it off the top). For the most part, more complex operations are implemented in terms of those.

To represent this, I gave every student a pile of paper plates. I then instructed them to execute certain Forth operations with those plates. When instructed to push a number onto the stack, they wrote the number on a plate and put it on top of their stacks. When instructed to add the top two numbers on the stack, they removed them, added them, and pushed a new number onto the stack.

Push 7 and 6 to the top of the stack, then add the top two items of the stack and push the result on top. The result will be 13.

8 6 +

Push 2 and 3 to the top of the stack, then multiply the top two items of the stack, pushing the result on top. The result will be six.

2 3 *

I instructed them to perform many operations until they were familiar with what they were doing. They were acting as Forth interpreters. The computer is just doing this work automatically. This gave them a more intimate understanding of what their system was doing.

Only then did their machines do the work for them.

Moving Forth

With the stack fresh in their memories, we marched forward, following Easy Forth lessons week by week, keeping pace to complete them by the end of the course. It proceeded without issue. I explained the concepts, they did the exercises, and I answered questions as they came up.

Since we only had twelve hours together, the final project had to be small, but it also had to demonstrate the knowledge built up throughout the course. I determined that we would use the graphics framework created in Easy Forth to make our own art of any variety. It could be a picture, an animation, or a game. I didn't really believe they had time to make a game, but they were encouraged to tinker with the built-in snake game in order to make something unique.

EasyForth Snake Demo EasyForth Snake game

In order to make this easier, I extracted the code for the Easy Forth playground and made it into its own page. Instead of a small box that displayed the graphics defined by the Forth code, I expanded it into a large playground with the code on one side and the graphics on the other.

During our final session, I told them to modify the snake game. They quickly discovered they could change the rules and colors with small changes to the code. They didn't have the skills to refactor anything major, but they had developed enough familiarity with Forth that they weren't scared away from exploring and tinkering.

Then I had them make their own art. I gave them an example of using the built-in graphics to draw things, and even showed an example of creating a word to make drawing shapes like lines easier. Every student decided to make their own art. For the most part, they stuck to drawing pixel by pixel.

Once they were done drawing, the class was over and the course was complete. I told them I would keep my copy of the learning environment online for a while. They were welcome to keep experimenting and learning on their own if they wished.

Reflections on Forth

In retrospect, Forth was an interesting language to teach kids, but I'm not sure if it was the best option. While the language lacked difficult syntax, it also required thinking about parts of software systems even a lot of programmers keep tucked safely abstracted below the level they normally work. The stack is a fundamental data structure, but it's not necessarily something students need front-and-center during their early education.

Even with Forth's drawbacks, the fact that the resulting code was a mere series of words was powerful. A concatenative programming language with more higher-level constructs may be helpful for teaching. Possibly something like Factor, or even a radically different approach!

I would have probably chosen a medium that provides even more clear and immediate visual feedback and even less emphasis on the underlying structures. Something like Scratch, which teaches control flow, variables, functions, and the like, but without some of the lower level details. And it's easy to make sprites move!

Overall, I don't believe the programming language matters all too much. For the most part, Forth is as perfectly capable as any other language. This short course showed that students can learn it effectively. Some students may pick up some paradigms better than others, but there is likely no way to perfectly micro-optimize the learning process. Provide kids with an environment that allows them to see the output of their work quickly and repeatably, and I believe most will thrive. Opportunity for self-direction is key.

Regardless, this class gave both me and my students a unique experience. If any of them choose to pursue programming going forward, they have already taken a low-level introduction. One that required an intimate understanding of a fundamental data structure in computer science. It provided me with an opportunity to learn and grow as a teacher—to iterate in teaching the same way I asked them to iterate in learning.

The Importance of Teaching

One last addendum to wrap this up. As programming becomes driven by stochastic automation, it's even more vital to teach people how to program themselves. For those who already know how to program, our skills will atrophy if we begin to rely on LLMs. But for those who haven't ever learned skills like programming, using LLMs may cause them to surrender the skill entirely.

Additionally, many people who do want to learn new skills are turning to LLMs, increasingly replacing learning from potentially reputable sources with learning from a technology which has been shown to be inaccurate, sycophantic, and in some cases seriously worsen mental illness. All of these are more dangerous in kids, who are just learning how to interact with the world for themselves.

Because of this, it's essential to provide everyone, especially kids, a human-centered environment to learn vital skills like programming. More people from various backgrounds should be willing to devote our time and energy to share the knowledge we have, as well as explaining how to safely obtain further knowledge.

Even if you're not a teacher, learn to teach. Embrace these opportunities. Create spaces where knowledge flows freely between people. Skip the stochastic parrot.