A tiny joke programming language with its own editor, terminal, and interpreter — running entirely in your browser.
Made by DS & Jay
🔗 Try it live: nardjay.github.io
SpudLang is a small, playful programming language inspired by Python, but with a potato-themed twist. It has its own syntax, its own interpreter, its own error messages, and a slick editor + terminal interface — all packed into a single HTML file with zero dependencies, zero build steps, and zero backend.
You write code in the left pane. You see output in the right pane. You press Ctrl + Enter and the potato does its thing.
It's not meant to replace Python. It's meant to make you smile while you learn how a programming language actually works under the hood.
- Custom language — variables, conditionals, loops, functions, and a built-in standard library
- In-browser interpreter — lexer, parser, and evaluator written from scratch in vanilla JavaScript
- Live syntax highlighting — keywords, strings, numbers, comments, and built-ins get colored in real time
- VS Code-style terminal — inline prompts, scrollback, colored output, and friendly errors
- Auto-save — your code persists in the browser via localStorage, even after closing the tab
- Zero dependencies — no npm, no build step, no framework. Just one HTML file.
- Fully offline — once loaded, it works without an internet connection
- Open the app in your browser
- Write some SpudLang code in the left pane
- Press Ctrl + Enter (or Cmd + Enter on Mac) to run it
- Watch the terminal respond in real time
Every program must end with the magic line:
run spud
That's the ignition switch. Without it, nothing cooks.
Plant a variable with spud. Once planted, you can reassign it with just the name.
spud age = 25
age = 26
mash age
Variables declared inside a block { } stay inside that block. They don't leak out.
mash prints. ask waits for the user to type something.
mash "Hello, potato!"
spud name = ask "What's your name? "
mash "Nice to meet you, " + name + "!"
ask always returns text, even if the user typed a number. Convert with num() when you need a real number.
ish age >= 18 {
mash "You can vote."
} nope ish age >= 13 {
mash "Teenager."
} nope {
mash "Still a kid."
}
Two kinds of loops:
loop i from 1 to 5 {
mash i
}
keep count < 10 {
count = count + 1
}
Use peel to break out, and sprout to skip to the next iteration.
recipe add(a, b) {
serve a + b
}
mash add(2, 3)
Recipes without serve return nada.
SpudLang is strict about types. You can't add a number to text without converting first.
| Type | Example |
|---|---|
| Number | 42, 3.14, -7 |
| Text | "hello", 'hi' |
| Truth | yep, nah |
| Nothing | nada |
Falsy values: nah, nada, 0, and "". Everything else is truthy.
- and, or, not
- ==, !=, <, >, <=, >=
Important: 1 == "1" is false. Numbers and text are never equal.
The standard library gives you a handful of handy functions out of the box:
| Function | What it does |
|---|---|
| len(text) | Length of a string |
| scream(text) | UPPERCASE |
| whisper(text) | lowercase |
| abs(n) | Absolute value |
| floor/ceil/round | Rounding |
| sqrt(n) | Square root |
| random(lo, hi) | Random integer, inclusive |
| str(x) | Convert to text |
| num(x) | Convert to number |
| type(x) | Description of a value |
| max / min | Largest / smallest |
| repeat(text, n) | Repeat text n times |
| potato() | 🥔 |
The app has a built-in cheat sheet accessible via the 📖 Cheat sheet button. It covers every keyword, every rule, and every built-in function — perfect for when you forget the syntax.
Here's a mini chatbot written entirely in SpudLang:
mash "🥔 SpudBot v0.1"
spud alive = yep
spud count = 0
recipe reply(user) {
spud u = whisper(user)
ish u == "hi" or u == "hello" {
serve "Hey there! I'm SpudBot 🥔"
}
ish u == "joke" {
serve "Why did the potato cross the road? It saw a fork!"
}
ish u == "count" {
serve "You've sent me " + str(count) + " message(s)."
}
serve "I don't know that one. Try 'help'."
}
keep alive == yep {
spud user = ask "you: "
count = count + 1
mash "SpudBot: " + reply(user)
ish whisper(user) == "bye" {
alive = nah
}
}
run spud
Copy that into the editor, hit Ctrl + Enter, and chat with a potato.
SpudLang runs entirely in your browser using three classic interpreter stages:
- Tokenizer — scans the source text and turns it into a stream of tokens (keywords, numbers, strings, operators)
- Parser — reads those tokens and builds a syntax tree, checking grammar and structure
- Interpreter — walks the tree and executes each node, managing scopes and values as it goes
Everything is written in plain JavaScript inside a single HTML file. No frameworks, no bundlers, no dependencies. Just a script tag and a lot of enthusiasm.
Errors are displayed with line numbers, column markers, and a source snippet, so you can see exactly where things went wrong — like a real language.
spudlang/
index.html <- the whole thing
README.md <- you're reading it
That's it. One file to run them all.
SpudLang is hosted for free on GitHub Pages. Because it's a static HTML file, it works on any static host:
- GitHub Pages
- Cloudflare Pages
- Netlify
- Vercel
- Or literally any web server
No backend required. No database. No monthly bill.
Things that would be fun to add:
- Arrays and indexing (spud nums = [1, 2, 3])
- A for each loop (loop x in nums { })
- String methods (split, trim, contains)
- A share-link button that encodes your code into the URL
- Multiple files / tabs in the editor
- More potato jokes in the error messages
Made with 🥔 by DS & Jay.
Built as a fun side project to explore how programming languages actually work — from tokenizing raw text to executing a syntax tree, all inside a single browser tab.
If you enjoyed it, tell a friend. If you broke it, open an issue. If you loved it, send us a potato.
MIT — do whatever you want with it. Just don't blame us if your potato overheats. 🥔💨