Whisper
Programming language · on PyPI
A programming language with conversational English syntax — you write
whisper "hello" and when age greater than 18: instead
of symbols. It also has story objects, so you can declare a character or an item
in a sentence and build interactive fiction and games out of them. I started it
after finding out CPython is written in C, which raised a question I couldn't let
go of: what actually happens between my source file and the output? Answering
that meant writing my own lexer, parser and interpreter.
It's installable with pip install whisper-lang, has a VS Code
extension for syntax highlighting, and documentation with a tutorial and
examples. Python 3.7+, no dependencies, MIT licensed.
# a greeting ask "What is your name?" into name whisper "Hello, " + name + "!" let age be 25 when age greater than 18: whisper "You are an adult!" there is a dragon with health 150, attack 25, treasure 500
The hardest part was story objects — the feature that makes Whisper feel like
Whisper. there is a dragon with health 150, attack 25 reads
beautifully, but underneath, attributes kept leaking between objects: I'd ask
for the player's health and get the dragon's. Every fix surfaced another one.
I came close to deleting the feature entirely. What fixed it was giving each
object its own namespace instead of resolving every name against one shared
table — obvious in hindsight, and the reason scope stopped being a word I'd
only read about.