It's really good
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Stephen 25c2da107d Fixed FAQ 3 months ago
Makefile First commit (hopefully last) 3 months ago Fixed FAQ 3 months ago
compiler.c First commit (hopefully last) 3 months ago
decompiler.c First commit (hopefully last) 3 months ago

The B Programming Language

Most languages these days are needlessly bloated, and there doesn’t seem to be any escape. The best you can do is write in raw binary, but even this is overkill. After all, who needs 2 different symbols?

The B programming language is the newest cool kid on the block. Its alphabet only consists of one symbol - the lowercase letter “b”!

How it works

The compiler reads the input string, counting the number of lowercase letter “b"s. (Note that this means comments can be put anywhere, as long as they don’t consist of any lowercase letter “b"s). This number is printed back in big-endian binary. For example, if passed in the string “bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb” (that’s 65 “b"s), the compiler would output the string “a”. This can be used to write any programming language - Python, Ruby, C, or even a raw binary file!

There is also a decompiler, which will take an input program/file and convert it to a valid B program.




The biggest disadvantage is file size. Source code will grow exponentially relative to output size. Note that this is also an advantage - you don’t have to worry about your code getting stolen if it is too large to copy.

Binary size (bytes) Maximum source code size
0 0 bytes
1 256 bytes
2 65 KB
3 17 MB
4 4 GB
5 1 TB
6 281 TB
7 72 PB
8 18 EB

The compiler only supports up to 8 byte executables. If this is a problem for you, please submit a pull request.


Q: Why?

A: bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb