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 Formats For BITSET Types

Types

BITSET

Syntax

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

Values and Value Lists
bitsetValue :
    bitsetNotation;

bitsetValueList :
    bitsetValue ( listSeparator bitsetValue )* ;

listSeparator :
    defaultListSeparator | userDefinedListSeparator | newline ;

defaultListSeparator :
    ',' whitespace ;

userDefinedListSeparator :
    character whitespace? ;
Arrays and Array Lists
bitsetArray :
     openingArrayDelimiter bitsetValueList closingArrayDelimiter ;

bitsetArrayList :
    bitsettArray ( listSeparator bitsetArray )* ;

openingArrayDelimiter :
    ( defaultOpeningArrayDelimiter | userDefinedOpeningArrayDelimiter ) whitespace ;

closingArrayDelimiter :
    whitespace ( defaultClosingArrayDelimiter | userDefinedOpeningArrayDelimiter ) ;

defaultOpeningArrayDelimiter :
    '{' ;

defaultClosingArrayDelimiter :
    '}' ;

userDefinedOpeningArrayDelimiter :
    '(' | '[' ;

userDefinedClosingArrayDelimiter :
    ')' | ']' ;
Bitset Notation
bitsetNotation :
    unpaddedBitsetValue | leftPaddedBitsetValue | rightPaddedBitsetValue ;

leftPaddedBitsetValue :
    whitespace+ unpaddedBitsetValue ;

rightPaddedBitsetValue :
    unpaddedBitsetValue whitespace+ ;

whitespace :
    ' ' ;

unpaddedBitsetValue :
    simpleFormat | binaryFormat ;

simpleFormat :
    '{' whitespace ( element ( ',' whitespace element )* whitespace )? '}' ;

binaryFormat :
    '{' whitespace ( digitGroup ( digitGroupSeparator digitGroup )* whitespace )? '}' ;

element :
    decimalDigit+ ;

digitGroup :
    binaryDigit+ ;

digitGroupSeparator :
    whitespace | '.'  ;

decimalDigit :
    '0' .. '9' ;

binaryDigit :
    '0' | '1' ;

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

Static Semantics

  • all values in a list are shown with identical formatting.