|Stephen 25c2da107d||10 months ago|
|Makefile||11 months ago|
|README.md||10 months ago|
|compiler.c||11 months ago|
|decompiler.c||11 months ago|
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"!
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|
The compiler only supports up to 8 byte executables. If this is a problem for you, please submit a pull request.