From Modula-2 Reloaded

WiP: Output Formats For SYSTEM Types

Types

BYTE, WORD, ADDRESS, MACHINEBYTE, MACHINEADDRESS

Syntax

The EBNF for the textual representation of values of system types is

Values and Value Lists
systemUnitValue :
    systemUnitNotation;

systemUnitValueList :
    systemUnitValue ( listSeparator systemUnitValue )* ;

listSeparator :
    defaultListSeparator | userDefinedListSeparator | newline ;

defaultListSeparator :
    ',' whitespace ;

userDefinedListSeparator :
    character whitespace? ;
Arrays and Array Lists
systemUnitArray :
     openingArrayDelimiter systemUnitValueList closingArrayDelimiter ;

systemUnitArrayList :
    systemUnitArray ( listSeparator systemUnitArray )* ;

openingArrayDelimiter :
    ( defaultOpeningArrayDelimiter | userDefinedOpeningArrayDelimiter ) whitespace ;

closingArrayDelimiter :
    whitespace ( defaultClosingArrayDelimiter | userDefinedOpeningArrayDelimiter ) ;

defaultOpeningArrayDelimiter :
    '{' ;

defaultClosingArrayDelimiter :
    '}' ;

userDefinedOpeningArrayDelimiter :
    '(' | '[' ;

userDefinedClosingArrayDelimiter :
    ')' | ']' ;
System Unit Notation
systemUnitNotation :
    unpaddedSystemUnitValue | leftPaddedSystemUnitValue | rightPaddedSystemUnitValue ;

leftPaddedSystemUnitValue :
    whitespace+ unpaddedSystemUnitValue ;

rightPaddedSystemUnitValue :
    unpaddedSystemUnitValue whitespace+ ;

whitespace :
    ' ' ;

unpaddedSystemUnitValue :
    simpleFormat | otherFormats ;

simpleFormat :
    digitGroup ( digitGroupSeparator digitGroup )* ;

otherFormats :
    base16CLiteralFmt | base16M2LiteralFmt ;

base16CLiteralFmt :
    '0' 'x' base16DigitLowercase+ ;

base16M2LiteralFmt :
    '0' base16DigitUppercase+ 'H' ;

base16DigitLowercase :
    '0' .. '9' | 'a' .. 'f' ;

base16DigitUppercase :
    '0' .. '9' | 'A' .. 'F' ;

digitGroup :
    base16DigitUppercase+ ;

digitGroupSeparator :
    whitespace | '.' | ':' ;

newline :
    <runtime host dependent ASCII control sequence for new line> ;

Static Semantics

Retrieved from http://modula-2.net/m2r10/pmwiki.php?n=WiP.OutputFormatsForSYSTEMTypes
Page last modified on 2010-02-02 09:24