BBLang

BB stands for Breaking Bad. Someone built a programming language where you sayMyName to print stuff and callSaul instead of else. Files end in .bb. You run them with bbc.

Mess up the syntax and the error message sends you to Saul Goodman. That's the bit people actually remember.

hello.bb
alias name = "Heisenberg"

when name == "Heisenberg" {
    sayMyName "You're goddamn right."
} callSaul {
    sayMyName "Better call Saul."
}

How it works

Four steps. Nothing fancy.

  1. 1

    Write a .bb file

    Text file. Use sayMyName to print, cook for functions, when / callSaul for branches. Normal programming, weird words.

  2. 2

    Run bbc run hello.bb

    bbc is the CLI. Install once with npm, then use it like you'd use node.

  3. 3

    It becomes JavaScript

    BBLang reads your file and converts it to JS behind the scenes. You don't edit the JS. Happens every time you run bbc run.

  4. 4

    Node prints the output

    sayMyName shows up in your terminal. Break something and you get the Saul error instead of a normal parse error.

.bbbbc → JavaScript → terminal

What you get

Variables, printing, if/else, loops, functions, user input. The usual beginner-language stuff. Won't replace Python for your day job. Good for messing around if you watched the show.

Words

sayMyName "hi" and say_my_name("hi") both work for printing.

normal BBLang does
printsayMyNameprint to terminal
inputaskWalterwait for typed input
functioncookdefine a function
returnwalkAwayreturn from function
ifwhenif true, run this block
elsecallSaulotherwise run this
loop 5 timesrepeat 5run block 5 times
whilekeepCookingloop while condition true
integergramswhole numbers
decimalprecisenumbers with a dot
stringaliastext in quotes
booleanfact, yes/notrue/false
arraybatchlist in [ ]
randomflipCoin()random number
lengthcountEvidence()string/array length
upper / lowerlawyerUp / layLowchange case
sleepwaitForIt()pause (ms)

Examples

Save as whatever.bb, then bbc run whatever.bb.

hello

sayMyName "Hello from BBLang"

variables

alias name = "Jesse"
grams purity = 99
sayMyName name
sayMyName purity

function

cook add(a, b) {
    walkAway a + b
}
sayMyName add(5, 3)

if / else

grams age = 20
when age >= 18 {
    sayMyName "empire business"
} callSaul {
    sayMyName "call Saul"
}

Errors

Use else by mistake and you get this:

I don't know what happened. You may call Saul Goodman for help.

  Scene: line 4, column 1

  Heisenberg expected:
    callSaul or closing brace }

  But Gus found:
    else

  Tip: Say my name.

Yeah. callSaul, not else.

Install

Node 18+. Paste in terminal:

clone + build

git clone https://github.com/godstark82/bblang.git
cd bblang
npm install
npm run build
npm install -g .

new project

bbc init
bbc run src/main.bb

or run bundled example

bbc run examples/hello.bb

Commands

  • bbc run file.bb run the file
  • bbc compile file.bb write a .js file
  • bbc watch file.bb re-run on save
  • bbc init create src/main.bb in current dir
  • bbc repl type code interactively

FAQ

What is BBLang?

A small open-source language for Breaking Bad fans. You write .bb files, run them with bbc, and the syntax uses show quotes instead of boring keywords.

What does sayMyName do?

Prints to the terminal. Same job as print in Python or console.log in JavaScript. Write sayMyName "hello" or say_my_name("hello").

What is callSaul?

The else branch. Pair it with when (if). Mess up and the compiler literally tells you to call Saul Goodman.

How do I install it?

Clone bblang on GitHub, run npm install, npm run build, then npm install -g .. Needs Node 18+.

Is this official Breaking Bad merchandise?

No. Fan project. Not affiliated with AMC, Sony, or anyone who owns the show.