Modula-2 Reloaded

A Modern Typesafe & Literate Programming Notation

Site Menu

Project

Specification

Implementation

Recommendations

Reference

Needs Updating

Work in Progress

Wastebasket

Wiki Manual

edit SideBar

Output Format For Type OCTET

WiP.OutputFormatForTypeOCTET History

Hide minor edits - Show changes to output

2010-02-02 07:52 by benjk -
Changed lines 82-83 from:
   binaryDigit binaryDigit binaryDigit binaryDigit binaryDigit binaryDigit binaryDigit binaryDigit "B" ;
to:
   binaryDigitGroup binaryDigitGroup "B" ;
Added lines 86-88:

binaryDigitGroup :
    binaryDigit binaryDigit binaryDigit binaryDigit ;
2010-02-02 07:50 by benjk -
Added lines 1-99:
!!!Types
@@OCTET@@

!!!Syntax
The EBNF for the textual representation of values of type octet is

!!!!!Values and Value Lists
[@
octetValue :
    octetNotation;

octetValueList :
    octetValue ( listSeparator octetValue )* ;

listSeparator :
    defaultListSeparator | userDefinedListSeparator | newline ;

defaultListSeparator :
    ',' whitespace ;

userDefinedListSeparator :
    character whitespace? ;
@]

!!!!!Arrays and Array Lists
[@
octetArray :
    openingArrayDelimiter octetValueList closingArrayDelimiter ;

octetArrayList :
    octetArray ( listSeparator octetArray )* ;

openingArrayDelimiter :
    ( defaultOpeningArrayDelimiter | userDefinedOpeningArrayDelimiter ) whitespace ;

closingArrayDelimiter :
    whitespace ( defaultClosingArrayDelimiter | userDefinedOpeningArrayDelimiter ) ;

defaultOpeningArrayDelimiter :
    '{' ;

defaultClosingArrayDelimiter :
    '}' ;

userDefinedOpeningArrayDelimiter :
    '(' | '[' ;

userDefinedClosingArrayDelimiter :
    ')' | ']' ;
@]

!!!!!Octet Notation
[@
octetNotation :
    unpaddedOctetValue | leftPaddedOctetValue | rightPaddedOctetValue ;

leftPaddedOctetValue :
    whitespace+ unpaddedOctetValue ;

rightPaddedOctetValue :
    unpaddedOctetValue whitespace+ ;

whitespace :
    ' ' ;

unpaddedOctetValue :
    simpleFormat | otherFormats ;

simpleFormat :
    base16DigitUppercase base16DigitUppercase ;

otherFormats :
    base16CLiteralFmt | base16M2LiteralFmt | binaryM2LiteralFmt ;

base16CLiteralFmt :
    '0' 'x' base16DigitLowercase base16DigitLowercase ;

base16M2LiteralFmt :
    '0' base16DigitUppercase base16DigitUppercase 'H' ;

binaryM2LiteralFmt :
    binaryDigit binaryDigit binaryDigit binaryDigit binaryDigit binaryDigit binaryDigit binaryDigit "B" ;

binaryDigit  :
    '0' | '1' ;

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

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

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

!!!Static Semantics
* all values in a list are shown in the same notation.
* all values in a list are shown with identical formatting.