Syntax for Configuration Files

Config                           = MetaBlock { ConstantsBlock | MemoryMapBlock | RegisterMapBlock | 
                                   TargetConfigurationBlock | RegInitBlock | ProjectBlock | 
                                   OperatingSystemBlock | SysConstBlock } .

MetaBlock                        = "meta" "{" VersionAssigment FileDescAssigment [ImportAssigment] "}" .
ConstantsBlock                   = "constants" "{" {VarAssigment} "}" .
MemoryMapBlock                   = "memorymap" "{" {DeviceBlock | SegmentBlock | RegInitBlock | 
                                   ModulesBlock | SegmentArray } "}" .
RegisterMapBlock                 = "registermap" "{" { RegisterBlock } "}" . 
TargetConfigurationBlock         = "targetconfiguration" Designator "{" ModulesBlock | RegInitBlock | 
                                   SystemTableBlock  "}" .
RegInitBlock                     = "reginit" "{" { VarAssigment } "}" .
ProjectBlock                     = "project" "{" { RootClassAssignments | LibPathAssignment | 
                                   DebugLevelAssignment | PrintLevelAssignment } "}" .
OperatingSystemBlock             = "operatingsystem" "{" { SystemClassBlock } "}" .
SysConstBlock                    = "sysconst" "{" {VarAssigment} "}" .

DeviceBlock                      = "device" Designator "{" [AttributeAssigment] [BaseAssigment] 
                                   [WidthAssigment] [SizeAssigment][TechnologyAssignment] 
                                   [MemorytypeAssignment] [Memorysector] [MemorysectorArray] "}" .
SegmentBlock                     = "segment" SegmentDesignator "{" ([AttributeAssigment] [BaseAssigment] 
                                   [WidthAssigment] [SizeAssigment]) {SegmentArray | SegmentBlock} "}".
ModulesBlock                     = "modules" "{" { ModuleAssignment } "}" .
SegmentArray                     = "segmentarray" SegmentDesignator  "{" SegmentSizeAssignment 
                                   [AttributeAssigment] [BaseAssigment] [ArraySizeAssignment]
                                   [WidhtAssignment][NofSegmentAssignment] "}" .
RegisterBlock                    = "register" Designator "{" TypeAssignment AddressAssignment 
                                   SizeAssignment [registerRepresentationAssignment] "}" . 
SystemTableBlock 	         = "system" "{" ModuleAssignment {ModuleAssignment} "}" .
SystemClassBlock		 = ("kernel" | "heap" | "us" | "exception" | "lowlevel" | 
                                   "exceptionbaseclass") "{" ClassAssignment [MethodBlock] "}" .
MethodBlock                      = "method" Designator "{" { AttributeAssignment | IdAssignment | 
                                   OffsetAssignment } "}" .
Memorysector                     = "memorysector" Designator "{" ([BaseAssigment] 
                                   [SectorSizeAssignment])"}".
MemorysectorArray                = "memorysectorarray" Designator "{"  SectorSizeAssignment BaseAssigment 
                                   NofSectorAssignment "}" .

VersionAssigment                 = "version" AssignOp String EndToken .
FileDescAssigment                = "description" AssignOp String EndToken .
ImportAssigment                  = "import" AssignOp StringEnum EndToken .

VarAssigment                     = Designator AssignOp Expression  EndToken .
RootClassAssignments             = "rootClasses" AssignOp StringEnum EndToken .
LibPathAssignment                = "libpath" AssignOp StringEnum EndToken .
DebugLevelAssignment             = "debugLevel" AssignOp IntNumber EndToken .
PrintLevelAssignment             = "printlevel" AssignOp IntNumber EndToken .

AttributeAssigment               = "attributes" AssignOp AttributeEnum EndToken .
BaseAssigment                    = "base" AssignOp Expression EndToken .
WidthAssigment                   = "width" AssignOp Expression  EndToken .
SizeAssigment                    = "size" AssignOp Expression EndToken .
TechnologyAssignment             = "technology" AssignOp Technology EndToken .

MemorytypeAssignment             = "memorytype" AssignOp String EndToken .
ModuleAssignment		 = (SystemModules | ConcatenatedDesignator ){EnumSeparator (SystemModules 
                                   | ConcatenatedDesignator ) }  ":" ContentAttribute "@" 
                                   SegmentDesignator {EnumSeparator ContentAttribute "@" SegmentDesignator} EndToken .
SegmentSizeAssignment            = "segmentsize" AssingOp Expression EndToken .
ArraySizeAssignment              = "arraysize" AssignOp Expression EndToken . 
NofSegmentAssignment             = "nofsegments" AssignOp Expression EndToken .
TypeAssignment                   = "type" AssignOp Type EndToken .
AddressAssignment                = "addr" AssignOp Expression EndToken .
RegisterRepresentationAssignment = "repr" AssignOp RegisterRep EndToken . 
ClassAssignment                  = "class" AssignOp String EndToken . 
IdAssignment			 = "id" AssignOp Expression EndToken .
OffsetAssignment		 = "offset" AssignOp Expression EndToken .
SectorSizeAssignment		 = "sectorsize" AssignOp Expression EndToken .
NofSectorAssignment              = "nofsectors" AssignOp Expression EndToken .

AttributeEnum                    = Attribute { EnumSeparator Attribute } .
StringEnum                       = String { EnumSeparator String } .
SegmentDesignator                = Designator { "." Designator }  .
ConcatenatedDesignator           = Designator { ("." | "/") Designator } [".*" | "/*"] .

Designator                       = Letter {Letter | Digit} .
String                           = '"' {any character except " } '"'.
Letter                           = a...z | A...Z | "_" | "<" | ">" .

Expression                       = Term { ( "+" | "-" ) Term } .
Term                             = Factor { ( "*" | "/" ) Factor } .
Factor                           = IntNumber | "(" Expression ")" | Designator .

Attribute                        = ContentAttribute | MethodAttribute | "read" | "write" .
ContentAttribute                 = "const" | "code" | "var" | "heap" | "stack" | "systab" .
MethodAttribute                  = "new" | "NEW" | "unsafe" | "UNSAFE" | "synthetic" | "SYNTEHTIC" | "exchnd" | "EXCHND" .

Type				 = RegisterType | SpezialRegisterType .
RegisterType                     = "GPR" | "FPR" | "SPR" | "IOR"| "gpr" | "fpr" | "spr" | "ior".
SpezialRegisterType              = "CR" | "MSR" | "FPSCR" .

RegisterRep                      = "hex" | "dez" | "bin" | "Hex" | "Dez" | "Bin" .
SystemModules                    = "kernel" | "exceptions" | "heap" | "default" | "systemtable" .
Technology                       = "RAM" | "FLASH" .

EnumSeparator                    = "," .
AssignOp                         = "=" .
EndToken                         = ";" .

Digit                            = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" .
HexDigit                         = Digit | "a" | "b" | "c" | "d" | "e" | "f" | "A" | "B" | "C" | "D" | "E" | "F" .
IntNumber                        = ( Digit {Digit} ) | ( "0" ( "x" | "X") HexDigit {HexDigit} ) .