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 Numeric Types Representing Complex Numbers

WiP.OutputFormatsForNumericTypesRepresentingComplexNumbers History

Hide minor edits - Show changes to output

2010-01-28 13:42 by benjk -
Changed line 200 from:
   <runtime host dependent ASCII control sequence for new line>
to:
   <runtime host dependent ASCII control sequence for new line> ;
2010-01-28 13:41 by benjk -
Added lines 198-200:

newline :
    <runtime host dependent ASCII control sequence for new line>
2010-01-28 13:36 by benjk -
Changed lines 16-17 from:
   defaultListSeparator | userDefinedListSeparator ;
to:
   defaultListSeparator | userDefinedListSeparator | newline ;
Changed line 29 from:
    newline | character whitespace? ;
to:
   character whitespace? ;
2010-01-28 13:34 by benjk -
Changed line 29 from:
   character whitespace? ;
to:
    newline | character whitespace? ;
2010-01-28 13:31 by benjk -
Added lines 195-197:

character :
    <any printable ASCII character> ;
2010-01-28 13:22 by benjk -
Changed line 152 from:
   ' ' | '+' | '-' ;
to:
   whitespace | '+' | '-' ;
2010-01-28 12:49 by benjk -
Changed line 143 from:
   integralPart decimalPoint fractionalPart ;
to:
   integralPart ( decimalPoint | decimalComma ) fractionalPart ;
2010-01-28 10:29 by benjk -
Changed line 32 from:
!!!!!Arrays
to:
!!!!!Arrays and Array Lists
Added lines 36-38:

complexNumberArrayList :
    complexNumberArray ( listSeparator complexNumberArray )* ;
2010-01-28 08:40 by benjk -
Added lines 30-53:
@]

!!!!!Arrays
[@
complexNumberArray :
    openingArrayDelimiter complexNumberValueList closingArrayDelimiter ;

openingArrayDelimiter :
    ( defaultOpeningArrayDelimiter | userDefinedOpeningArrayDelimiter ) whitespace ;

closingArrayDelimiter :
    whitespace ( defaultClosingArrayDelimiter | userDefinedOpeningArrayDelimiter ) ;

defaultOpeningArrayDelimiter :
    '{' ;

defaultClosingArrayDelimiter :
    '}' ;

userDefinedOpeningArrayDelimiter :
    '(' | '[' ;

userDefinedClosingArrayDelimiter :
    ')' | ']' ;
2010-01-28 06:41 by benjk -
Added line 7:
!!!!!Values and Value Lists
2010-01-28 06:40 by benjk -
Changed lines 12-28 from:
   complexNumberValue ( ',' whitespace complexNumberValue )* ;
to:
   complexNumberValue ( listSeparator complexNumberValue )* ;

listSeparator :
    defaultListSeparator | userDefinedListSeparator ;

defaultListSeparator :
    defaultListSeparatorForValuesWithCommas |
    defaultListSeparatorForValuesWithoutCommas ;

defaultListSeparatorForValuesWithCommas :
    ';' whitespace ;

defaultListSeparatorForValuesWithoutCommas :
    ',' whitespace ;

userDefinedListSeparator :
    character whitespace?
;
2010-01-27 13:05 by benjk -
Changed line 93 from:
   negativeSign? decimalDigit '.' decimalDigit+ exponent ;
to:
   negativeSign? decimalDigit decimalPoint decimalDigit+ exponent ;
2010-01-27 12:35 by benjk -
Changed line 46 from:
   decimalDigit+ decimalPoint decimalDigit+ ;
to:
   decimalDigit+ ( decimalPoint | decimalComma ) decimalDigit+ ;
2010-01-27 11:51 by benjk -
Changed lines 161-164 from:
* in decimal comma mode:
**
@@decimalComma@@ is shown
** @@decimalCommaModePartSeparator@@ is shown
** @@decimalCommaModeDigitSeparator@@ is shown
to:
* in decimal comma mode, @@decimalComma@@ is shown instead of @@decimalPoint@@, @@decimalCommaModePartSeparator@@ is shown instead of @@decimalPointModePartSeparator@@ and @@decimalCommaModeDigitSeparator@@ is shown instead of @@decimalPointModeDigitSeparator@@.
2010-01-27 11:49 by benjk -
Changed lines 160-163 from:
* in decimal point mode:
**
@@decimalPoint@@ is shown instead of @@decimalComma@@
** @@decimalPointModePartSeparator@@ is shown instead of @@decimalCommaModePartSeparator@@
** @@decimalPointModeDigitSeparator@@ is shown instead of @@decimalCommaModeDigitSeparator@@
to:
* in decimal point mode, @@decimalPoint@@ is shown instead of @@decimalComma@@, @@decimalPointModePartSeparator@@ is shown instead of @@decimalCommaModePartSeparator@@ and @@decimalPointModeDigitSeparator@@ is shown instead of @@decimalCommaModeDigitSeparator@@.
2010-01-27 11:48 by benjk -
Changed lines 161-163 from:
** @@decimalPoint@@ is shown
** @@decimalPointModePartSeparator@@ is shown
** @@decimalPointModeDigitSeparator@@ is shown
to:
** @@decimalPoint@@ is shown instead of @@decimalComma@@
** @@decimalPointModePartSeparator@@ is shown instead of @@decimalCommaModePartSeparator@@
** @@decimalPointModeDigitSeparator@@ is shown instead of @@decimalCommaModeDigitSeparator@@
2010-01-27 11:47 by benjk -
Changed lines 155-158 from:
* for all values in a list @@imaginaryPartDesignator@@ is the same.
* in pair notation, all values in a list have identical formatting in every detail.
* in pair notation, real and imaginary part have identical formatting in every detail.
* @@digitSeparator@@ and @@decimalPoint@@ are never the same symbol
.
to:
* all values in a list are shown with identical formatting.
* all values in a list are shown with identical imaginary part designators.
* real and imaginary parts are shown with identical formatting.
Added lines 160-167:
* in decimal point mode:
** @@decimalPoint@@ is shown
** @@decimalPointModePartSeparator@@ is shown
** @@decimalPointModeDigitSeparator@@ is shown
* in decimal comma mode:
** @@decimalComma@@ is shown
** @@decimalCommaModePartSeparator@@ is shown
** @@decimalCommaModeDigitSeparator@@ is shown
2010-01-27 11:27 by benjk -
Changed lines 132-138 from:
   whitespace | '.' | ',' ;
to:
   decimalPointModeDigitSeparator | decimalCommaModeDigitSeparator ;

decimalPointModeDigitSeparator :
    whitespace | ',' ;

decimalCommaModeDigitSeparator :
    whitespace | '.
' ;
2010-01-27 11:24 by benjk -
Added lines 81-83:
   decimalPointModePartSeparator | decimalCommaModePartSeparator ;

decimalPointModePartSeparator :
Added lines 86-88:
decimalCommaModePartSeparator :
    ';' whitespace ;

Changed lines 102-103 from:
   engIntegralPart decimalPoint fractionalPart engExponent ;
to:
   engIntegralPart ( decimalPoint | decimalComma ) fractionalPart engExponent ;
Changed lines 138-141 from:
   '.' | ',' ;
to:
   '.' ;

decimalComma :
 
',' ;
2010-01-27 09:24 by benjk -
Changed lines 139-141 from:
* values in a list are always shown in the same notation.
* for values in a list @@imaginaryPartDesignator@@ is always the same.
* in pair notation, values in a list have identical formatting in every detail.
to:
* all values in a list are shown in the same notation.
* for all values in a list @@imaginaryPartDesignator@@ is the same.
* in pair notation, all values in a list have identical formatting in every detail.
2010-01-27 09:23 by benjk -
Deleted lines 145-154:

Formatting detail means the following:
* any padding
* any formatting related to the sign
* any formatting related to the fill character
* any formatting related to digit grouping
* the character used as a decimal point
* any formatting related to the exponent,
* whether or not engineering format is used
* the number of integral, fractional and exponent digits shown if specified by the format
2010-01-27 07:52 by benjk -
Changed lines 148-150 from:
* the appearance of the sign
*
the fill character used
* the style of
digit grouping
to:
* any padding
* any formatting related to
the sign
* any formatting related to the fill character
* any formatting related to
digit grouping
Changed line 153 from:
* the appearance of the exponent,
to:
* any formatting related to the exponent,
2010-01-27 07:50 by benjk -
Changed lines 146-154 from:
[-Formatting detail means the appearance of the sign, the fill character used, the style of digit grouping, the character used as a decimal point, the appearance of the exponent, whether or not engineering format is used and if specified by the format, the number of integral, fractional and exponent digits shown-]
to:

Formatting detail means the following:
*
the appearance of the sign
* the fill character
used
* the style of digit grouping
* the character used as a decimal point
* the appearance of the exponent,
* whether or not engineering format is used
* the number of integral, fractional and exponent digits shown if specified by the format
2010-01-27 07:48 by benjk -
Changed line 146 from:
[-Formatting detail means sign style, filler style, digit grouping style, decimal point style, exponent style and if specified by the format, the number of integral, fractional and exponent digits shown-]
to:
[-Formatting detail means the appearance of the sign, the fill character used, the style of digit grouping, the character used as a decimal point, the appearance of the exponent, whether or not engineering format is used and if specified by the format, the number of integral, fractional and exponent digits shown-]
2010-01-27 07:46 by benjk -
Changed line 146 from:
[-Formatting detail means sign style, filler style, digit grouping style, decimal point style, exponent style and the number of integral, fractional and exponent digits shown if their number is specified by the format-]
to:
[-Formatting detail means sign style, filler style, digit grouping style, decimal point style, exponent style and if specified by the format, the number of integral, fractional and exponent digits shown-]
2010-01-27 07:44 by benjk -
Added line 146:
[-Formatting detail means sign style, filler style, digit grouping style, decimal point style, exponent style and the number of integral, fractional and exponent digits shown if their number is specified by the format-]
2010-01-27 07:38 by benjk -
Changed lines 141-142 from:
* in pair notation, values in a list have identical formatting in every possible detail.
* in pair notation, real and imaginary part have identical formatting in every possible detail.
to:
* in pair notation, values in a list have identical formatting in every detail.
* in pair notation, real and imaginary part have identical formatting in every detail.
2010-01-27 07:37 by benjk -
Changed lines 141-142 from:
* for values in a list and for all components formatting is always the same.
to:
* in pair notation, values in a list have identical formatting in every possible detail.
* in pair notation, real and imaginary part have identical formatting in every possible detail
.
2010-01-27 07:31 by benjk -
Changed lines 139-141 from:
* values in a list are always shown in the same notation and format.
* for all values in a list
@@imaginaryPartDesignator@@ is the same.
* real and imaginary parts are always shown in the same format.
to:
* values in a list are always shown in the same notation.
* for values in a list
@@imaginaryPartDesignator@@ is always the same.
* for values in a list and for all components formatting is always the same.
2010-01-27 07:25 by benjk -
Changed line 139 from:
* values in a list are always shown in the same notation.
to:
* values in a list are always shown in the same notation and format. 
2010-01-27 07:21 by benjk -
Changed line 140 from:
* for values in a list @@imaginaryPartDesignator@@ is always the same.
to:
* for all values in a list @@imaginaryPartDesignator@@ is the same.
2010-01-27 07:20 by benjk -
Changed line 140 from:
* values in a list always show the same imaginary part designator.
to:
* for values in a list @@imaginaryPartDesignator@@ is always the same.
2010-01-27 07:18 by benjk -
Added line 140:
* values in a list always show the same imaginary part designator.
2010-01-27 07:11 by benjk -
Changed lines 111-112 from:
   decimalDigit decimalDigit? decimalDigit? ( digitGroupSeparator? digitGroup )* ;
to:
   decimalDigit decimalDigit? decimalDigit? ( digitSeparator? digitGroup )* ;
Changed lines 114-115 from:
   ( ( ( decimalDigit digitGroupSeparator? )? decimalDigit )? decimalDigit )? decimalDigit ;
to:
   ( ( ( decimalDigit digitSeparator? )? decimalDigit )? decimalDigit )? decimalDigit ;
Changed lines 117-118 from:
   ( decimalDigit ( decimalDigit ( decimalDigit digitGroupSeparator )? )? )* decimalDigit ;
to:
   ( decimalDigit ( decimalDigit ( decimalDigit digitSeparator )? )? )* decimalDigit ;
Changed line 125 from:
digitGrouSeparator :
to:
digitSeparator :
Changed line 141 from:
* @@digitGroupSeparator@@ and @@decimalPoint@@ are never the same symbol.
to:
* @@digitSeparator@@ and @@decimalPoint@@ are never the same symbol.
2010-01-27 07:09 by benjk -
Changed lines 111-112 from:
   decimalDigit decimalDigit? decimalDigit? ( separator? digitGroup )* ;
to:
   decimalDigit decimalDigit? decimalDigit? ( digitGroupSeparator? digitGroup )* ;
Changed lines 114-115 from:
   ( ( ( decimalDigit separator? )? decimalDigit )? decimalDigit )? decimalDigit ;
to:
   ( ( ( decimalDigit digitGroupSeparator? )? decimalDigit )? decimalDigit )? decimalDigit ;
Changed lines 117-118 from:
   ( decimalDigit ( decimalDigit ( decimalDigit separator )? )? )* decimalDigit ;
to:
   ( decimalDigit ( decimalDigit ( decimalDigit digitGroupSeparator )? )? )* decimalDigit ;
Changed line 125 from:
separator :
to:
digitGrouSeparator :
Changed line 141 from:
* @@separator@@ and @@decimalPoint@@ never both use the same symbol.
to:
* @@digitGroupSeparator@@ and @@decimalPoint@@ are never the same symbol.
2010-01-27 07:03 by benjk -
Added line 139:
* values in a list are always shown in the same notation.
2010-01-27 07:02 by benjk -
Changed lines 139-141 from:
* @@separator@@ and @@decimalPoint@@ must never both use the same symbol.
* the numeric value represented by @@engExponent@@ must always be divisible by three.
* the numeric value represented by @@simpleNonZeroDecimalRealNumber@@ must not be zero.
to:
* real and imaginary parts are always shown in the same format.
* @@separator@@ and @@decimalPoint@@ never both use the same symbol.
* the numeric value represented by @@engExponent@@ is always divisible by three.
* the numeric value represented by @@simpleNonZeroDecimalRealNumber@@ is never
zero.
2010-01-27 06:57 by benjk -
Changed line 12 from:
   complexNumberValue ( ',' whitespace complexNumberValue)* ;
to:
   complexNumberValue ( ',' whitespace complexNumberValue )* ;
2010-01-27 06:57 by benjk -
Added lines 10-12:

complexNumberValueList :
    complexNumberValue ( ',' whitespace complexNumberValue)* ;
Added line 14:
Deleted lines 135-139:
@]
!!!!!Complex Number Lists
[@
complexNumberValueList :
    complexNumberValue ( ',' whitespace complexNumberValue)* ;
2010-01-27 06:56 by benjk -
Added lines 132-136:
@]
!!!!!Complex Number Lists
[@
complexNumberValueList :
    complexNumberValue ( ',' whitespace complexNumberValue)* ;
2010-01-27 06:46 by benjk -
Changed line 95 from:
   fixedFmtNumeral exponent ;
to:
   fixedFmtDecimal exponent ;
2010-01-27 06:44 by benjk -
Changed lines 85-88 from:
realNumerOtherFormats :
    sign? fillChar* ( fixedFmtNumeral | engFmtNumeral | expFmtNumeral ) ;

fixedFmtNumeral :
to:
realNumberOtherFormats :
    sign? fillChar* ( fixedFmtDecimal | engFmtDecimal | expFmtDecimal ) ;

fixedFmtDecimal :
Changed line 91 from:
engFmtNumeral :
to:
engFmtDecimal :
Changed line 94 from:
expFmtNumeral :
to:
expFmtDecimal :
2010-01-27 06:41 by benjk -
Changed lines 68-73 from:
   '(' whitespace complexPairComponents whitespace ')' ;

complexPairComponents :
    realComponent componentSeparator imaginaryComponent ;

realComponent
:
to:
   '(' realPart partSeparator imaginaryPart ')' ;

realPart :
Changed line 73 from:
imaginaryComponent :
to:
imaginaryPart :
Changed line 76 from:
componentSeparator :
to:
partSeparator :
2010-01-26 17:04 by benjk -
Changed lines 56-63 from:
   unpaddedComplexNumber | leftPaddedComplexNumber | rightPaddedComplexNumber ;

leftPaddedComplexNumber :
    whitespace+ unpaddedComplexNumber ;

rightPaddedComplexNumber :
    unpaddedComplexNumber whitespace+ ;
to:
   unpaddedComplexPair | leftPaddedComplexPair | rightPaddedComplexPair ;

leftPaddedComplexPair :
    whitespace+ unpaddedComplexPair ;

rightPaddedComplexPair :
    unpaddedComplexPair whitespace+ ;
Changed lines 67-70 from:
unpaddedComplexNumber :
    '(' whitespace complexNumberComponents whitespace ')' ;

complexNumberComponents :
to:
unpaddedComplexPair :
    '(' whitespace complexPairComponents whitespace ')' ;

complexPairComponents :
Changed lines 74-75 from:
   realNumber ;
to:
   formattedRealNumber ;
Changed lines 77-78 from:
   realNumber ;
to:
   formattedRealNumber ;
Changed line 82 from:
realNumber :
to:
formattedRealNumber :
2010-01-26 17:00 by benjk -
Deleted line 137:
* the numeric value represented by @@simpleNonZeroDecimalRealNumber@@ must not be zero
Added line 140:
* the numeric value represented by @@simpleNonZeroDecimalRealNumber@@ must not be zero.
2010-01-26 16:59 by benjk -
Added line 138:
* the numeric value represented by @@simpleNonZeroDecimalRealNumber@@ must not be zero
2010-01-26 16:58 by benjk -
Changed line 10 from:
to:
@]
Changed line 12 from:
to:
[@
Changed line 52 from:
to:
@]
Changed line 54 from:
to:
[@
2010-01-26 16:57 by benjk -
Added lines 11-12:
!!!!!Mathematical Notation
Added lines 52-53:

!!!!!Pair Notation
2010-01-26 16:11 by benjk -
Changed lines 40-41 from:
   decimalDigit+ '.' decimalDigit+ ;
to:
   decimalDigit+ decimalPoint decimalDigit+ ;
Deleted lines 119-121:
decimalPoint :
    '.' | ',' ;

Added lines 125-127:

decimalPoint :
    '.' | ',' ;
2010-01-26 16:08 by benjk -
Changed lines 28-29 from:
   simpleSign? simpleDecimalRealNumber ;
to:
   simpleSign? simpleNonZeroDecimalRealNumber ;
Changed lines 31-32 from:
   simpleDecimalRealNumber imaginaryPartDesignator;
to:
   simpleNonZeroDecimalRealNumber imaginaryPartDesignator;
Changed line 39 from:
simpleDecimalRealNumber :
to:
simpleNonZeroDecimalRealNumber :
Deleted lines 49-51:

simpleNonZeroDecimalRealNumber :
    decimalDigit+ '.' decimalDigit+ ;
2010-01-26 16:05 by benjk -
Changed lines 9-15 from:
   mathNotation | pairNotation ;

mathNotation :
    mathNotationAllPartsZero | mathNotationImaginaryPartZero |
    mathNotationRealPartZero | mathNotationAllPartsNonZero ;

mathNotationAllPartsZero :
to:
   compactNotation | expandedNotation | pairNotation ;

compactNotation :
    compactNotationAllPartsZero | compactNotationImaginaryPartZero |
    compactNotationRealPartZero | compactNotationAllPartsNonZero ;

compactNotationAllPartsZero :
Changed lines 18-27 from:
mathNotationImaginaryPartZero :
    mathNotationRealPart ;

mathNotationRealPartZero ;
    mathNotationImaginaryPart ;

mathNotationAllPartsNonZero :
    mathNotationRealPart mathNotationImaginaryPartWithForcedSign ;

mathNotationRealPart :
to:
compactNotationImaginaryPartZero :
    compactRealPart ;

compactNotationRealPartZero ;
    simpleSign? compactImaginaryPart ;

compactNotationAllPartsNonZero :
    compactRealPart simpleSign compactImaginaryPart ;

compactRealPart :
Changed lines 30-35 from:
mathNotationImaginaryPart :
    simpleSign? simpleDecimalRealNumber imaginaryPartDesignator;

mathNotationImaginaryPartWithForcedSign :
    simpleSign simpleDecimalRealNumber imaginaryPartDesignator
;
to:
compactImaginaryPart :
    simpleDecimalRealNumber imaginaryPartDesignator;
Added lines 40-51:
   decimalDigit+ '.' decimalDigit+ ;

expandedNotation :
    expandedRealPart simpleSign expandedImaginaryPart ;

expandedRealPart :
    '0' | simpleNonZeroDecimalRealNumber ;

expandedImaginaryPart :
  ( '0' | simpleNonZeroDecimalRealNumber ) imaginaryPartDesignator ;

simpleNonZeroDecimalRealNumber :
2010-01-26 11:30 by benjk -
Added lines 30-32:
mathNotationImaginaryPart :
    simpleSign? simpleDecimalRealNumber imaginaryPartDesignator;

Deleted lines 34-36:

mathNotationImaginaryPart :
    simpleSign? simpleDecimalRealNumber imaginaryPartDesignator;
2010-01-26 11:28 by benjk -
Changed lines 12-35 from:
   mathNotationAllComponentsZero | mathNotationImaginaryComponentZero |
    mathNotationRealComponentZero | mathNotationAllComponentsNonZero ;

mathNotationAllComponentsZero :
    '0' '.' '0' ;

mathNotationImaginaryComponentZero :
    mathNotationRealComponent ;

mathNotationRealComponentZero ;
    mathNotationImaginaryComponent 'i' ;

mathNotationAllComponentsNonZero :
    mathNotationImaginaryComponent 'i' mathNotationRealComponentWithForcedSign ;

mathNotationRealComponent :
    simpleSign? simpleDecimalRealNumeral ;

mathNotationRealComponentWithForcedSign :
    simpleSign simpleDecimalRealNumeral ;

mathNotationImaginaryComponent :
    simpleSign? simpleDecimalRealNumeral ;
to:
   mathNotationAllPartsZero | mathNotationImaginaryPartZero |
    mathNotationRealPartZero | mathNotationAllPartsNonZero ;

mathNotationAllPartsZero :
    '0' ;

mathNotationImaginaryPartZero :
    mathNotationRealPart ;

mathNotationRealPartZero ;
    mathNotationImaginaryPart ;

mathNotationAllPartsNonZero :
    mathNotationRealPart mathNotationImaginaryPartWithForcedSign ;

mathNotationRealPart :
    simpleSign? simpleDecimalRealNumber ;

mathNotationImaginaryPartWithForcedSign :
    simpleSign simpleDecimalRealNumber imaginaryPartDesignator ;

mathNotationImaginaryPart :
    simpleSign? simpleDecimalRealNumber imaginaryPartDesignator;
Changed lines 39-42 from:
simpleDecimalRealNumeral :
to:
imaginaryPartDesignator :
    'i' | 'j' ;

simpleDecimalRealNumber
:
2010-01-26 11:18 by benjk -
Deleted lines 54-56:
   parenthesesEnclosedComplexNumber | bracesEnclosedComplexNumber ;

parenthesesEnclosedComplexNumber :
Deleted lines 55-57:

bracesEnclosedComplexNumber :
    '{' whitespace complexNumberComponents whitespace '}' ;
2010-01-26 11:15 by benjk -
Changed lines 9-10 from:
   mathNotation | compoundNotation ;
to:
   mathNotation | pairNotation ;
Changed line 42 from:
compoundNotation :
to:
pairNotation :
2010-01-24 18:00 by benjk -
Changed line 40 from:
   decimalDigit+ decimalPoint decimalDigit+ ;
to:
   decimalDigit+ '.' decimalDigit+ ;
2010-01-24 17:55 by benjk -
Changed line 19 from:
   simpleRealComponent ;
to:
   mathNotationRealComponent ;
2010-01-24 17:54 by benjk -
Changed line 11 from:
simpleNotation :
to:
mathNotation :
2010-01-24 11:31 by benjk -
Changed lines 9-10 from:
   simpleNotation | compoundNotation ;
to:
   mathNotation | compoundNotation ;
Changed lines 12-15 from:
   simpleNotationAllComponentsZero | simpleNotationImaginaryComponentZero |
    simpleNotationRealComponentZero | simpleNotationAllComponentsNonZero ;

simpleNotationAllComponentsZero :
to:
   mathNotationAllComponentsZero | mathNotationImaginaryComponentZero |
    mathNotationRealComponentZero | mathNotationAllComponentsNonZero ;

mathNotationAllComponentsZero :
Changed line 18 from:
simpleNotationImaginaryComponentZero :
to:
mathNotationImaginaryComponentZero :
Changed lines 21-27 from:
simpleNotationRealComponentZero ;
    simpleImaginaryComponent 'i' ;

simpleNotationAllComponentsNonZero :
    simpleImaginaryComponent 'i' simpleRealComponentWithForcedSign ;

simpleRealComponent :
to:
mathNotationRealComponentZero ;
    mathNotationImaginaryComponent 'i' ;

mathNotationAllComponentsNonZero :
    mathNotationImaginaryComponent 'i' mathNotationRealComponentWithForcedSign ;

mathNotationRealComponent :
Changed line 30 from:
simpleRealComponentWithForcedSign :
to:
mathNotationRealComponentWithForcedSign :
Changed line 33 from:
simpleImaginaryComponent :
to:
mathNotationImaginaryComponent :
Added lines 76-81:
   realNumberSimpleFormat | realNumberOtherFormats ;

realNumberSimpleFormat :
    negativeSign? decimalDigit '.' decimalDigit+ exponent ;

realNumerOtherFormats :
2010-01-24 10:12 by benjk -
Changed lines 9-35 from:
   unpaddedComplexNumberValue | leftPaddedComplexNumberValue | rightPaddedComplexNumberValue ;

leftPaddedComplexNumberValue :
    padding+ unPaddedComplexNumberValue ;

rightPaddedComplexNumberValue :
    unpaddedComplexNumberValue padding+ ;

unpaddedComplexNumberValue :
    simpleFormat | otherFormats ;

otherFormats :
    sign? fillChar* ( fixedFmtNumeral | engFmtNumeral | expFmtNumeral ) suffix? ;

simpleFormat :
    negativeSign? decimalDigit '.' decimalDigit+ exponent ;

fixedFmtNumeral :
 
  integralPart decimalPoint fractionalPart ;

engFmtNumeral :
    engIntegralPart decimalPoint fractionalPart engExponent ;

expFmtNumeral :
    fixedFmtNumeral exponent ;

padding :
to:
   simpleNotation | compoundNotation ;

simpleNotation :
    simpleNotationAllComponentsZero | simpleNotationImaginaryComponentZero |
    simpleNotationRealComponentZero | simpleNotationAllComponentsNonZero ;

simpleNotationAllComponentsZero :
    '0' '.' '0' ;

simpleNotationImaginaryComponentZero :
    simpleRealComponent ;

simpleNotationRealComponentZero ;
 
   simpleImaginaryComponent 'i' ;

simpleNotationAllComponentsNonZero :
    simpleImaginaryComponent 'i' simpleRealComponentWithForcedSign ;

simpleRealComponent :
 
  simpleSign? simpleDecimalRealNumeral ;

simpleRealComponentWithForcedSign :
    simpleSign simpleDecimalRealNumeral ;

simpleImaginaryComponent :
    simpleSign? simpleDecimalRealNumeral ;

simpleSign :
    '+' | '-' ;

simpleDecimalRealNumeral :
    decimalDigit+ decimalPoint decimalDigit+ ;

compoundNotation :
    unpaddedComplexNumber | leftPaddedComplexNumber | rightPaddedComplexNumber ;

leftPaddedComplexNumber :
    whitespace+ unpaddedComplexNumber ;

rightPaddedComplexNumber :
    unpaddedComplexNumber whitespace+ ;

whitespace
:
Added lines 54-86:
unpaddedComplexNumber :
    parenthesesEnclosedComplexNumber | bracesEnclosedComplexNumber ;

parenthesesEnclosedComplexNumber :
    '(' whitespace complexNumberComponents whitespace ')' ;

bracesEnclosedComplexNumber :
    '{' whitespace complexNumberComponents whitespace '}' ;

complexNumberComponents :
    realComponent componentSeparator imaginaryComponent ;

realComponent :
    realNumber ;

imaginaryComponent :
    realNumber ;

componentSeparator :
    ',' whitespace ;

realNumber :
    sign? fillChar* ( fixedFmtNumeral | engFmtNumeral | expFmtNumeral ) ;

fixedFmtNumeral :
    integralPart decimalPoint fractionalPart ;

engFmtNumeral :
    engIntegralPart decimalPoint fractionalPart engExponent ;

expFmtNumeral :
    fixedFmtNumeral exponent ;

Changed lines 94-95 from:
   ' ' | '*' | '0' ;
to:
   whitespace | '*' | '0' ;
Changed lines 115-116 from:
   ' ' | '.' | ',' ;
to:
   whitespace | '.' | ',' ;
Deleted lines 121-126:

suffix :
    ''' character* ''' ;

character :
    <any printable ASCII character except single quotation mark>
2010-01-24 08:55 by benjk -
Added lines 1-83:
!!!Types
@@COMPLEX@@, @@LONGCOMPLEX@@

!!!Syntax
The EBNF for the textual representation of values of types that represent complex numbers is

[@
complexNumberValue :
    unpaddedComplexNumberValue | leftPaddedComplexNumberValue | rightPaddedComplexNumberValue ;

leftPaddedComplexNumberValue :
    padding+ unPaddedComplexNumberValue ;

rightPaddedComplexNumberValue :
    unpaddedComplexNumberValue padding+ ;

unpaddedComplexNumberValue :
    simpleFormat | otherFormats ;

otherFormats :
    sign? fillChar* ( fixedFmtNumeral | engFmtNumeral | expFmtNumeral ) suffix? ;

simpleFormat :
    negativeSign? decimalDigit '.' decimalDigit+ exponent ;

fixedFmtNumeral :
    integralPart decimalPoint fractionalPart ;

engFmtNumeral :
    engIntegralPart decimalPoint fractionalPart engExponent ;

expFmtNumeral :
    fixedFmtNumeral exponent ;

padding :
    ' ' ;

sign :
    ' ' | '+' | '-' ;

negativeSign :
    '-' ;

fillChar :
    ' ' | '*' | '0' ;

integralPart :
    decimalDigit decimalDigit? decimalDigit? ( separator? digitGroup )* ;

engIntegralPart :
    ( ( ( decimalDigit separator? )? decimalDigit )? decimalDigit )? decimalDigit ;

fractionalPart :
    ( decimalDigit ( decimalDigit ( decimalDigit separator )? )? )* decimalDigit ;

exponent :
    'E' ( '+' | '-' ) decimalDigit decimalDigit+ ;

engExponent :
    exponent ;

decimalPoint :
    '.' | ',' ;

separator :
    ' ' | '.' | ',' ;

digitGroup :
    decimalDigit decimalDigit decimalDigit ;

decimalDigit  :
    '0' .. '9' ;

suffix :
    ''' character* ''' ;

character :
    <any printable ASCII character except single quotation mark>
@]

!!!Static Semantics
* @@separator@@ and @@decimalPoint@@ must never both use the same symbol.
* the numeric value represented by @@engExponent@@ must always be divisible by three.