Back to the log
[project]2025.03.158 min readdrawn by Muhammed Musthafa S

How I Built a Programming Language from Scratch

The story behind PewPew — a custom programming language with a pixel-art game engine, built in C++17 with Flex/Bison and compiled to WebAssembly.

Why Build a Programming Language?

Not because the world needs another programming language. Because I needed to understand one deeply enough to teach it to a machine.

PewPew started as an experiment: could I build a language that's fun to write games in? Not a general-purpose language — a purpose-built one with a pixel-art game engine baked in.

The Stack

  • Lexer & Parser: Flex + Bison (yes, the classics)
  • Core: C++17
  • Browser Runtime: WebAssembly via Emscripten
  • Game Engine: Custom pixel-art renderer — SDL2 on desktop, browser canvas via WASM
  • IDE Theme: Borland Turbo C++ inspired

What I Learned

  1. Parsing is just pattern matching with state. Flex makes it almost fun.
  2. Code generation is the easy part. Getting the grammar right is the hard part.
  3. WASM is magic. C++ running in the browser at near-native speed? Yes please.
  4. A language without a game engine is just a calculator. The game engine makes it worth learning.

The Result

A full language — six data types, its own game engine, three run targets (SDL2 desktop, browser WASM, headless). A WASM runtime. A Borland Turbo IDE-themed playground. A PewPew Academy with eight interactive courses. And a Hall of Fame where people showcase what they've built.

Live at pewpew.outshorts.in.

#programming language#C++#WebAssembly#compiler#game engine

Enjoyed this entry?

Project

Outshorts

AI platforms, full-stack SaaS, custom systems, and ready-to-ship solutions — built by a studio that ships fast.

Title block

DRAWN BY
MUSTHAFA
SHEET
OUTSHORTS.IN
REV
2026

© 2026 OUTSHORTS — ALL SHEETS CURRENT