Skip to content

Chapter 3: ABIN Files explained

Riedl Kevin, Bsc. (WSDT) edited this page Jul 5, 2020 · 6 revisions

Get Started

Coding in Almost Binary is actually easier than you think.

Hello-World

To give you a better understanding how the compiler works, you'll find a valid Almost-Binary hello-world program and it's corresponding original strings.

helloworld.abin (x64-arch):

0000000000000000011010010110110101110000011011110111001001110100 0000000000000000011100110111100101110011011101000110010101101101

00000000000000000000000000000000000000000000000000000000000000000110011001110101011011100110001101110100011010010110111101101110 0000000000000000000000000000000001001101011000010110100101101110 0000000000000000000000000000000000000000000000000000000000101000 0000000000000000000000000000000000000000000000000000000000101001 
0000000000000000000000000000000000000000000000000000000001111011

	00000000000000000000000000000000000000000000000000000000010100000111001001101001011011100111010001001100011010010110111001100101 0000000000000000000000000000000000000000000000000000000000101000 0000000000000000000000000000000000000000000000000000000000100010000000000000000000000000000000000000000001001000011001010110110001101100011011110010000001010111011011110111001001101100011001000000000000000000000000000000000000000000000000000000000000100010 0000000000000000000000000000000000000000000000000000000000101001
	
	00000000000000000000000000000000000000000000000000000000000000000101001001100101011000010110010001001100011010010110111001100101 0000000000000000000000000000000000000000000000000000000000101000 0000000000000000000000000000000000000000000000000000000000101001
	
0000000000000000000000000000000000000000000000000000000001111101

Original strings:

import system

function Main()
{
    PrintLine("Hello World")
    ReadLine()
}

Some tips

Separate all tokens (even double quotes, commas, int-literals, identifiers, operators, etc.) via whitespace as the compiler doesn't has delimiters. I decided to design the compiler this way, to avoid introducing too much boilerplate like (0000000000000000, ...). Nevertheless, some tokens can be used without additional spaces (but I don't recommend it, as it can lead to unexpected behavior). In contrast to that, Int-Literals (~) must not contain spaces -> e.g. ~150~

The compiler ignores newlines and tabs, which basically means you could write something like this (= placing the whole code on the same line, ...):

Hello-World (x64-arch):

0000000000000000011010010110110101110000011011110111001001110100 000000000000000001110011011110010111001101110100011001010110110100000000000000000000000000000000000000000000000000000000000000000110011001110101011011100110001101110100011010010110111101101110 0000000000000000000000000000000001001101011000010110100101101110 0000000000000000000000000000000000000000000000000000000000101000 0000000000000000000000000000000000000000000000000000000000101001 000000000000000000000000000000000000000000000000000000000111101100000000000000000000000000000000000000000000000000000000010100000111001001101001011011100111010001001100011010010110111001100101 0000000000000000000000000000000000000000000000000000000000101000 0000000000000000000000000000000000000000000000000000000000100010000000000000000000000000000000000000000001001000011001010110110001101100011011110010000001010111011011110111001001101100011001000000000000000000000000000000000000000000000000000000000000100010 0000000000000000000000000000000000000000000000000000000000101001 00000000000000000000000000000000000000000000000000000000000000000101001001100101011000010110010001001100011010010110111001100101 0000000000000000000000000000000000000000000000000000000000101000 0000000000000000000000000000000000000000000000000000000000101001 0000000000000000000000000000000000000000000000000000000001111101

As Almost Binary is actually hard enough to write, I would recommend to code with tabs and newlines as you know it from regular programming languages. Thus, I recommend to insert a tab when e.g. opening a new if-block etc. The above program then will actually look like this:

Hello-World (x64-arch):

0000000000000000011010010110110101110000011011110111001001110100 0000000000000000011100110111100101110011011101000110010101101101

00000000000000000000000000000000000000000000000000000000000000000110011001110101011011100110001101110100011010010110111101101110 0000000000000000000000000000000001001101011000010110100101101110 0000000000000000000000000000000000000000000000000000000000101000 0000000000000000000000000000000000000000000000000000000000101001 
0000000000000000000000000000000000000000000000000000000001111011

	00000000000000000000000000000000000000000000000000000000010100000111001001101001011011100111010001001100011010010110111001100101 0000000000000000000000000000000000000000000000000000000000101000 0000000000000000000000000000000000000000000000000000000000100010000000000000000000000000000000000000000001001000011001010110110001101100011011110010000001010111011011110111001001101100011001000000000000000000000000000000000000000000000000000000000000100010 0000000000000000000000000000000000000000000000000000000000101001
	
	00000000000000000000000000000000000000000000000000000000000000000101001001100101011000010110010001001100011010010110111001100101 0000000000000000000000000000000000000000000000000000000000101000 0000000000000000000000000000000000000000000000000000000000101001
	
0000000000000000000000000000000000000000000000000000000001111101
Clone this wiki locally