Welcome, Guest
Username: Password:
  • Page:
  • 1

TOPIC:

Negative number in TTCN-3 20 Sep 2001 11:18 #5952

I guess we all agree that we would like to have negative floats and
integers in TTCN-3, don't we?

Anyway, as one of my colleagues has just pointed out to me, the BNF
grammar does not allow to express negative number literals.

Here are the relevant productions from the BNF (rev. 11):

IntegerValue ::= Number
FloatValue ::= FloatDotNotation | FloatENotation
FloatDotNotation ::= Number Dot DecimalNumber
FloatENotation ::= Number [Dot DecimalNumber] Exponential [Minus] Number
Number ::= (NonZeroNum {Num}) | 0
NonZeroNum ::= 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9

The easist fix in the grammer would be to change these productions as
follows:

IntegerValue ::= [Minus] Number
FloatDotNotation ::= [Minus] Number Dot DecimalNumber
FloatENotation ::= [Minus] Number [Dot DecimalNumber] Exponential
[Minus] Number

I don't have so much overview on the BNF grammar, so that I could say if
this would break things somewhere else, though.

Best regards

Stephan Tobies

--
Stephan Tobies Research Engineer, Nokia Research Center
Mobile Networks Lab, Protocol Engineering Group
E-Mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
Work Phone: +49-234-9842262
Address: NRC Bochum, Meesmannstr. 103, 44807 Bochum, Germany

Please Log in to join the conversation.

Negative number in TTCN-3 20 Sep 2001 14:09 #5954

On Thu, 20 Sep 2001, Stephen TOBIES wrote:

> I guess we all agree that we would like to have negative floats and
> integers in TTCN-3, don't we?
>
> Anyway, as one of my colleagues has just pointed out to me, the BNF
> grammar does not allow to express negative number literals.

No, but it does allow the unary prefix operation '-' which
can make every positive expression into a negative one,
so also integer literals.

Jacob

Please Log in to join the conversation.

  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin