# Turtle and decimals

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Tue, 12 Jun 2012 19:59:09 +0100
Message-ID: <4FD7917D.8040702@epimorphics.com>
To: RDF-WG <public-rdf-wg@w3.org>
```
The grammar rule for DECIMAL is

[21] DECIMAL ::= (([+-])? ([0-9])+ '.' ([0-9])+) | ('.' ([0-9])+)
^                             ^

which seems to have brackets in the wrong place.
It puts +/- only on the first form.

Rewritten with whitespace:

(([+-])? ([0-9])+ '.' ([0-9])+)
|
('.' ([0-9])+)

so .3 is legal but +.3 isn't.

Should that be:

([+-])?
( ( ([0-9])+ '.' ([0-9])+ )
|
('.' ([0-9])+)
)

ie.

([+-])? ( ( ([0-9])+ '.' ([0-9])+ ) | ('.' ([0-9])+) )
^1                      ^1
^2                                           ^2

simpler is

([+-])?  ( ([0-9])* '.' ([0-9])+  )

(this respects ISSUE-18).

- - - -
[22] DOUBLE ::=	(([+-])? ([0-9])+ '.' ([0-9])+ EXPONENT) | ('.' ([0-9])+
EXPONENT) | (([0-9])+ EXPONENT)

(([+-])? ([0-9])+ '.' ([0-9])+ EXPONENT) | ....
^                                      ^

suffers a similar problem.

Should be:

([+-])? ( [0-9]+ '.' [0-9]* EXPONENT | '.' ([0-9])+ EXPONENT | ([0-9])+
EXPONENT )

Andy

PS

.3 is illegal in N3 as is +.3 and -.3
N3 requires a digit before the dot.
Except it does not require the dot in the EBNF:

N3 grammar:
[-+]?[0-9]+\\.[0-9]*
or EBNF:
decimal ::=	[-+]?[0-9]+(\.[0-9]+)?

which are different and the latter reflects the old decimal/integer
issue in turtle and N3
```
Received on Tuesday, 12 June 2012 18:59:40 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 22:02:05 UTC