-
Notifications
You must be signed in to change notification settings - Fork 0
Chapter 1: Get Started
Almost Binary is a new esoteric programming language. Almost Binary is a hybrid language and compiles your code to WSDT-Code (yeah, I didn't find a better name) which is then executed in a lean runtime.
The compiler takes .abin-files which consist of 0s, 1s and whitespaces. Every other character will be ignored (e.g. new lines, tabs) or cause an unexpected-token exception. Thus, .abin-files will be compiled to .wsdt-files, which are then interpreted by the Almost Binary-Runtime.
Almost Binary is dynamically typed. Moreover, variables don't need to be declared and can be directly used.
variable = "Hello World"
As you can imagine, .abin files are just some pseudo binary code. You could consider it as high-level binary as it comes without any of the difficulties known from e.g. the lowest TCP-IP layers. This means you can actually code quite complex programs with Almost Binary as it uses high-level keywords known from popular programming languages and doesn't directly map to Assembly.
I'm sometimes bad at explaining, but here all underlying tokens/key-words:
Token/Key-Word | Short explanation | Binary (x64) |
---|---|---|
import | Imports an external library. Libraries need the .abinl-file extension. | 0000000000000000011010010110110101110000011011110111001001110100 |
function | Declares a function. Each program needs at least one main-function as entry-point. | 00000000000000000000000000000000000000000000000000000000000000000110011001110101011011100110001101110100011010010110111101101110 |
if | Regular if-statement. | 0000000000000000000000000000000000000000000000000110100101100110 |
elseif | Else-If statement. | 0000000000000000011001010110110001110011011001010110100101100110 |
else | Else statement. | 0000000000000000000000000000000001100101011011000111001101100101 |
repeat | Infinite loop. | 0000000000000000011100100110010101110000011001010110000101110100 |
return | Return value from function. | 0000000000000000011100100110010101110100011101010111001001101110 |
+ | Used for string concatenation and to add two numbers. | 0000000000000000000000000000000000000000000000000000000000101011 |
- | Subtract two numbers. | 0000000000000000000000000000000000000000000000000000000000101101 |
* | Multiply two numbers. | 0000000000000000000000000000000000000000000000000000000000101010 |
/ | Divide two numbers. | 0000000000000000000000000000000000000000000000000000000000101111 |
== | Are values equal? | 0000000000000000000000000000000000000000000000000011110100111101 |
!= | Are values not equal? | 0000000000000000000000000000000000000000000000000010000100111101 |
= | Used to assign values to variables. | 0000000000000000000000000000000000000000000000000000000000111101 |
( | E.g. used to wrap if, elseif statements and function args. | 0000000000000000000000000000000000000000000000000000000000101000 |
) | E.g. used to wrap if, elseif statements and function args. | 0000000000000000000000000000000000000000000000000000000000101001 |
{ | Starts a new block (e.g. loops, function, if, elseif, else, ..) | 0000000000000000000000000000000000000000000000000000000001111011 |
} | Ends a block (e.g. loops, function, if, elseif, else, ..) | 0000000000000000000000000000000000000000000000000000000001111101 |
, | Used to separate identifiers (e.g. when providing two args to a function) | 0000000000000000000000000000000000000000000000000000000000101100 |
. | Reserved for future use (e.g. object-orientation). | 0000000000000000000000000000000000000000000000000000000000101110 |
"your string" | Strings need to be wrapped in double quotes. | 0000000000000000000000000000000000000000000000000000000000100010000000000000000000000000000000000000000001111001011011110111010101110010001000000111001101110100011100100110100101101110011001110000000000000000000000000000000000000000000000000000000000100010 |
~103~ | Numbers need to be wrapped with ~ to avoid syntax errors. No Whitespaces within int-literal allowed! | 000000000000000000000000000000000000000000000000000000000111111000000000000000000000000000000000000000000011000100110000001100110000000000000000000000000000000000000000000000000000000001111110 |
identifier | Arbitrary identifiers (e.g. variable/function names, ..) | 0000000000000000000000000000000001101110011000010110110101100101 |