-
Notifications
You must be signed in to change notification settings - Fork 0
Chapter 4: Basic structure
Each .abin-program has to contain at least one Main-method, which is the entry-point of your program. Each .abin-file does need to have at least the following structure.
Untranslated program
function Main()
{
}
Translated program
0000000000000000011010010110110101110000011011110111001001110100 0000000000000000011100110111100101110011011101000110010101101101
0000000000000000000000000000000000000000000000000000000001111011
0000000000000000000000000000000000000000000000000000000001111101
You got to know all available key-words/tokens in Chapter 1. To write some useful programs you will need at least some basic functionality like printing a string to the console or waiting for user input.
Library files have the .abinl-file extension and have a translated file name. The system-library for example is called '011100110111100101110011011101000110010101101101.abinl'.
The system-library contains the most important methods to perform basic actions. Available functions:
- Print("hello world"): Prints values to the console.
- PrintLine("hello world with new line"): Prints values to the console and adds a new line.
- Read(): Reads a value from the stack.
- ReadLine(): Reads a line from the stack.
- InputString(): Waits for user input and returns the inputted value.
To use those functions, you'll have to import the library at the beginning of the file.
Original strings
import system
Translated strings
011010010110110101110000011011110111001001110100 011100110111100101110011011101000110010101101101
Above functions need to be translated as well. Please refer to Binarify. Here a simple example:
Original strings
PrintLine("Hello World")
Translated strings
010100000111001001101001011011100111010001001100011010010110111001100101 00101000 00100010 0100100001100101011011000110110001101111001000000101011101101111011100100110110001100100 00100010 00101001
You should be able to write your first program by using Binarify and referring to the example-files including the original-files.
The documentation will be improved continuously.