Skip to content
Project / Programming language

PewPew the language

A programming language built from scratch in C++. Meme-flavored syntax, four swappable vocabularies, a pixel game engine and an Academy, all running in the browser.

4
Skins

One engine, four vocabularies, identical output.

13
Stdlib modules

Including the game engine and an HTTP server.

8
Lessons

Hands-on, with auto-checked challenges.

5
Example games

Shooter, lander, pong, snake and star catcher.

Exhibit / Skins

One engine, four vocabularies

A skin swaps the words, not the language. The same program below is written in each skin and prints identical output, and even the error messages change tone. Pick a skin and press Run.

SKINS.DLL

hello.pewGen-Z, the default
do add(whole a, whole b) {
    gimme a + b
}
yell("starting up")
whole total = add(2, 3)
check (total == 5) {
    yell("total is correct: " + total)
} nah {
    yell("something is wrong")
}
repeat 3 times {
    yell("pew")
}
outputsame in every skin
Press Run.
C:\PEWPEW> _
meanspewpewprofessionalpiratelangbismillahlang
printyellprinthollerazaan
ifcheckifarrinshallah
elsenahelsevastilla
functiondofuncquestbismillah
returngimmereturnplunderameen
integerwholeintdoubloonadad
Exhibit / SKINS.DLL
Exhibit / Arcade

Games written in PewPew

The language ships a small pixel game engine. Star Catcher is one of five example games, and this is a playable browser replica of it. The real one is a 72 line PewPew file.

STAR CATCHER

Arrow keys, A / D, or move the pointer. Miss three and it is over.

Exhibit / ARCADE.EXE
bring "game"

whole W = 160
whole H = 120
game->canvas(W, H)
game->title("Star Catcher")

dotted px = 70
whole pw = 24
whole score = 0
whole lives = 3

loop (game->playing() && lives > 0) {
    check (game->key("left")  || game->key("a")) { px = px - 3 }
    check (game->key("right") || game->key("d")) { px = px + 3 }
    check (game->mousex() > 0) { px = game->mousex() - pw / 2 }
    // ... move the stars, score, lose lives ...
    game->clear("navy")
    game->box(px, H - 5, pw, 3, "green")
    game->text(3, 3, "SCORE " + score, "white")
    game->show()
    game->wait(20)
}
catch_star.pew / excerpt

The other four are a shooter, a lander, pong and snake. Source lines are copied from the real file.

Build story

How a class assignment got out of hand

How it started

It began in a Compiler Design class in semester 6. I learned how code turns into machine instructions and decided I should build a real compiler.

A few days into assembly manuals and memory allocation, I found out how hard that is. There are so many phases. I dropped the idea.

An interpreter sounded doable. I treated it as a weekend joke project to flex some C++. I wired up Flex and Bison, wrote a tree-walking evaluator, and made the syntax as goofy as I could. yell prints. check and nah are if and else.

The hardest part was the start

The first version was the hardest thing in the whole project. A language only works once the lexer, the parser and the interpreter all work together, so for a long time there is nothing to show.

Then it got out of hand

I got attached.

I started treating the codebase like my own kid. What began as a joke grew a standard library, a game engine, four skins, a browser version running on WebAssembly, and an Academy with courses. People now run yell("Hello") in a browser, and I still enjoy tuning the pipeline that makes that work.

What I am proud of

I made something that did not exist before: a language with a personality, built by one person. I want to make more things like it.

Want something like this?