Overview
A program is a sequence of statements executed one at a time in the order they are written, unless specified otherwise.
There is an implicit halt instruction at the very end.
Everything written after # is ignored.
Statement
A statement is:
- a simple statement, or
- a conditional statement written as
if A ?? B then Inst
Here A and B are expressions, Inst is a simple statement, and ?? is one of:
= <> < > <= >=
Simple statement
halt— stops executiongoto LABEL— transfers execution to a labelX := W— assignment
Labels are defined as name_of_label:, where the name is a C-like identifier.
Assignment
In X := W:
Xis an expression which is not a literal integerWis one of the following
Y Y + Z Y - Z Y * Z Y / Z Y % Z Y & Z Y | Z Y ^ Z Y << Z Y >> Z
/ is integer division rounded toward zero. In Y / Z, Z must be non-zero. In Y % Z, Z must be positive.
Expression
An expression is:
- a literal integer such as
5or-100 - a directly addressed memory cell:
[integer] - an indirectly addressed memory cell:
[[integer]]
Přehled
Program je posloupnost příkazů vykonávaných po jednom v pořadí, v jakém jsou zapsány, pokud není určeno jinak.
Na úplném konci programu je implicitní instrukce halt.
Vše, co je zapsáno za #, se ignoruje.
Příkaz
Příkaz je:
- jednoduchý příkaz, nebo
- podmíněný příkaz zapsaný jako
if A ?? B then Inst
Zde A a B jsou výrazy, Inst je jednoduchý příkaz a ?? je jeden z:
= <> < > <= >=
Jednoduchý příkaz
halt— zastaví vykonávánígoto LABEL— přenese vykonávání na návěštíX := W— přiřazení
Návěští se definuje jako name_of_label:, kde jméno je identifikátor ve stylu C.
Přiřazení
V X := W:
Xje výraz, který není celočíselný literálWje jedna z následujících možností
Y Y + Z Y - Z Y * Z Y / Z Y % Z Y & Z Y | Z Y ^ Z Y << Z Y >> Z
/ je celočíselné dělení se zaokrouhlením k nule. V Y / Z musí být Z nenulové. V Y % Z musí být Z kladné.
Výraz
Výraz je:
- celočíselný literál jako
5nebo-100 - přímo adresovaná paměťová buňka:
[integer] - nepřímo adresovaná paměťová buňka:
[[integer]]