Interpreter

Gene = {Include | Process | Library | Interprete | automation | automationCall | ANY }

Compiler

Gene = {Process | Library | Pragma | Private | Public | Global | Constant | Variable | enum | Store | Space | Struct | Union |
Rename | expression }
Process = "process" identifier ["(" Identifier ")"] 
{"OS" ["linux" | "win32" | "win32consolse"]
| ["platform" "x86"]
}
"="
             { "entry" ExpDefinition 
| SimpleVar
| ExpDeclerations}
}
          ";"
Library = "lib" identifier
{"OS" ["linux" | "win32" | "win32consolse"]
| ["platform" "x86"]
}
"="
          { "entry" ExpDefinition
| ExpDeclerations
|constructorDefs
|DestructorDefs }
}

          ";"
automation = "auto" Identifier "(" ["exp" | "space" | "store" | "struct" | "var" | "enum" | "rename" | "union" | "prop" ] ")" "="
{"var" "|<" {ANY} ">|"
|"prop" "|<" {ANY} ">|"
|"exp" "|<" {ANY} ">|"
|"chapter" {MemLoc}
|"is" "|<" {ANY} ">|"
} ";"
AutomationCall = AutomationName ["(" identifier ")" ] { "\" AutomationName ["(" identifier ")" ] } identifier [ typespecific ]
{ChapterName Value} ";"
Include = "include" UnitName {"," UnitName} ";"
Pragma = "pragma"
[ "interpretedict" ["on" | "off" | "excl"]
| "pack" [ ["push" | ] [1|4|8|16] | "pop" ]
| ["freelib" | "loadlib" | "procaddress" | "alloc" | "free"] designator
|
] ";"
Private = "private"
Public ="public"
Global = "global"
UnitName = string
Constant = "const" {Identifier "=" ConstValue } ";"
ConstValue = ["nil" | integer | Float | String | Bool | Char]
SimpleVar = "var" { MemLoc {MemLoc} }
Variable = "var" {MemLoc } ";"
Enum = "enum" Identifier "=" [Identifier ["=" integer]{"," Identifier ["=" integer]}] [MesssageSendDefs] ";"
MemLoc = Identifier ":" TypeDecleration ["=" ConstValue]
TypeDecleration = [ [Identifier | designator "." "entity"] [ [ "$" | {"^"}]
| "." Constructor
| "@" Integer
]
| Struct
| Union
| Space
| Store
| ExpDecleration
]
struct = "struct" Identifier ["(" Identifier ")"] "="
{SimpleVar
|PropDef
|ExpDeclerations
|OperatorDefs
|constructorDefs
|DestructorDefs
|MessageSendDefs
}";"
union = "union" Identifier "="
{SimpleVar
|ExpDeclerations
}";"
space = "space" Identifier ["(" Identifier ")"] "="
{SimpleVar
|PropDef
|ExpDeclerations
|OperatorDefs
|constructorDefs
|DestructorDefs
|MessageSendDefs
|MessageReceiveDefs
|"entity" TypeDecleration
|"storage" Identifier
|"Next" ExpDefinition
|"space" designator
}";"
rename = "rename" identifier "=" [ TypeDecleration | ExpDecleration ] ";"
Store = "store" Identifier ["(" [Identifier] ")"] "="
{ SimpleVar
|PropDef
|ExpDeclerations
|OperatorDefs
|MessageSendDefs
|MessageReceiveDefs
|constructorDefs
|DestructorDefs
|"Loop" ExpDefinition
|"space" {MemLoc}
|"entity" {MemLoc}
|"first" ["read" ExpDefinition] ["write" ExpDefinition]
|"last" ["read" ExpDefinition] ["write" ExpDefinition]
|"next" ["read" ExpDefinition] ["write" ExpDefinition]
 |"prev" ["read" ExpDefinition] ["write" ExpDefinition]
|"NrRecords" ["read" ExpDefinition] ["write" ExpDefinition]
|"pos" ["read" ExpDefinition] ["@" ExpDefinition] ["write" ExpDefinition]
}
";"
PropDef = "prop"
{identifier ":" TypeDecl
["read" [ExpDecleration | identifier |"var" MemLoc]]
["write" [ExpDecleration | identifier |"var" MemLoc]]
}
ExpDeclerations ="exp" { ExpDefinition}
ExpDecleration = "exp" ExpDefinition
ExpDefinition = Identifier ["(" [ MemLoc {","MemLoc} ")" ] [":" TypeDecleration]
["in" identifier[":" identifier] {", " identifier[":" identifier]} ]
["out" identifier[":" identifier] {", " identifier[":" identifier]} ]
["inline"] ["static"] ["extern" identifier ] ["abstract" | "override" | "virtual"]
["default"] [ExpImplementation]
OperatorDefs = { "'"Operator"'" ExpDefinition}
Operator =[ "*" | "/" | "%" |"&"
|"+" | "-" | "|" | "~"
|"=="| "<" |"<=" | ">" | ">=" | "<>"
|"=" | "+="|"-=" | "*="| "/=" |"%=" | "<<" | ">>" | "<<-" | "->>" ]
MessageReceiveDefs = "type" {MessageDef}
MessageSendDefs = "message" {MessageDef}
MessageDef = identifier ["read" ExpDefinition] ["write" ExpDefinition] ["is" ExpDefinition]
ConstructorDefs = "constructor" {ExpDefinition}
DestructorDefs = "destructor" {ExpDefinition}
Expression = identifier "." ExpDefinition ExpImplementation
ExpImplmentation = "=" {CodeItem}";"
CodeItem = {Memloc | Option | Loop | Return | Break | Continue | raise
| ExceptionHandler | RaiseException | Statement | Assembler | ConditionBlock }
Option = "[" CodeItems {CodeItems} "]"
Loop = "{" CodeItems {CodeItems} "}"
ConditionBlock ["<-" |">-" ] Condition ["\" Condition ["\" Condition ["\" Condition]]] ["->" |"-<" ]
Interprete = "#" InterpretableCodeItem
InterpretableCodeItem = [Memloc | Option | Loop | return | break | continue | Statement | ConditionBlock]
Return = "return" ["(" Condition ")"]
Break = "break"
Continue = "continue"
InheritedCall = "inherited" ["(" [Condition {"," condition} ] ")"]
raise = "raise" "(" [Designator] ")"
ExceptionHandler = "try" {CodeItem}["finally" CodeItem
| "except" [MemLoc] CodeItem {"except" [MemLoc] CodeItems}
]
RaiseException = "raise" Factor
Assembler = "asm" "[" {AssemblerStatements} "]"
Statement = Assignment
Assignment Condition AssignOp Condition
AssignOp = ["=" | "+=" | "-=" | "/=" | "*=" | "%=" | "<<" | "<<-" | ">>" | "->>" ]
Condition = AndCondition {"||" AndCondition }
AndCondition = BoolCondition {"&&" BoolCondition }
BoolCondition = Calculation {BoolOp Calculation}
BoolOp = ["==" | "<" | ">" | "<=" | ">=" | "<>" | "is"]
Calculation = ["+" | "-" | ] term {AddOp} term
AddOp = ["+" | "-" | "|" | "~" ]
term = Factor {MulOp Factor}
MulOp = ["*" | "/" | "%" | "&" ]
Designator = [identifier | SpaceSelector | "Self" ]
{"." [identifier | SpaceSelector | SpaceEntitySelector]
|"(" [Condition {"," Condition}] ["\" Assignment {"," Assignment} ] ")" ["@" Factor]
  |"@" Factor
  |"^"
}

SpaceSelector =  ["first" | "last | "NrRecords" | "store" ]
SpaceEntitySelector = ["Next" | "Prev" | "Pos" | "entity" | "cursor"]

Factor = [Designator | ConstValue | "(" Condition ")" | "!" Factor | "`" Factor | "@" Factor
| InheritedCall | "sizeof" "(" designator ")"
]