- Program : { Annotations | Data | Module | Code | Structure | Routine }
- Annotations :
pragma
PragmaDeclaration { PragmaDeclaration }end
- Data :
data
Identifier Literal { Literal }end
- Module :
module
Identifier { VarDeclaration | Routine | Structure }end
- Code :
code
{ Statement }end
- Structure :
struct
Identifier { VarDeclaration }end
- PragmaDeclaration : Identifier
(
["
Text"
])
- VarDeclaration : Type ( Variable | Array | Constant )
- Variable : VarDefinition {
,
VarDefinition };
- Constant :
const
ConstDefinition {,
ConstDefinition };
- Array :
[]
ArrDefinition {,
ArrDefinition };
- VarDefinition : Identifier [
:=
Expression ] - ConstDefinition : Identifier
:=
Expression - ArrDefinition : Identifier
[
Expression]
- Type : (
int
|short
|byte
[@
] ) | Identifier
- Routine :
routine
Identifier(
[ Parameters ])
[:
Type ] RoutineBody - Parameters : Parameter {
,
Parameter } - Parameter : Type Identifier
- RoutineBody :
do
{ Statement }end
- Statement : [ Label ] ( AssemblyBlock | ExtensionStatement )
- Label :
<
Identifier>
- AssemblyBlock:
asm
AssemblyStatement;
{ AssemblyStatement;
}end
- AssemblyStatement
:skip
// NOP
|stop
// STOP
|<
Identifier>
// Label
|format
( 8 | 16 | 32 ) // format of next command
| Register:=
->
Register
|->
Register:=
Register
| Register:=
Register
| Register:=
Identifier // Label
| Register:=
Expression // Should be in range [0-31]
| Register:=
Register + Expression
| Register+=
Register
| Register-=
Register
| Register>>=
Register
| Register<<=
Register
| Register|=
Register
| Register&=
Register
| Register^=
Register
| Register<=
Register
| Register>=
Register
| Register?=
Register
|if
Registergoto
Register - Register : R0 | R1 | ... | R30 | R31
- ExtensionStatement : Assignment | Swap | ( Call
;
) | If | Loop | Break | Return | VarDeclaration - Loop : For | While | LoopWhile
- For :
for
Identifier [from
Expression ] [to
Expression] [step
Expression ] LoopBodyend
- While :
while
Expression LoopBodyend
- LoopWhile : LoopBody
while
Expressionend
- LoopBody :
loop
BlockBody - BlockBody : { Statement }
- Break :
break
;
- Return :
return
[ ( Expression | Call ) ];
- Assignment : Receiver
:=
Expression;
- Swap : Reveiver
<=>
Receiver;
- Print :
print
Expression;
- If :
if
Expressiondo
BlockBody (end
|else
BlockBodyend
) - Call : Identifier CallArgs
- CallArgs :
(
[ Expression {,
Expression } ])
- Expression : Operand { Operator Operand }
- Operator :
+
|-
|*
|&
||
|^
|?
|=
|/=
|<
|>
|>=
|<=
- Operand : Primary | Register | Dereference | Reference | Literal |
(
Expression)
- Receiver : Primary | Dereference | Register
- Primary : Identifier {
.
Identifier } [ ArrayAccess | CallArgs ] - ArrayAccess :
[
Expression]
- Reference :
<-
Primary - Dereference :
->
[
Expression]
- Identifier : (_a-zA-Z0-9)+
- Literal: [
-
] (0-9)+ - Text: (\,\.\-_a-zA-Z0-9)+