Version française
Home     About     Download     Resources     Contact us    
Browse thread
Negative float consts
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christian Boos <boos@a...>
Subject: Negative float consts

	Hello caml-list,


I recently found the syntax of negative float consts to be annoying.
You have to write things like this:

	two_float_func 1.0 (-. 1.0) 

IMO, it is more pleasant to write instead:

	two_float_func 1.0 -1.0

so I tried the following change in the lexer:

  | '-'? ['0'-'9']+ '.' ['0'-'9']* (['e' 'E'] ['+' '-']? ['0'-'9']+)?
      { FLOAT (Lexing.lexeme lexbuf) }

... and everything worked well !  I think this could be an improvement in
the readability of numerical programs.

(an analog change may eventually be needed for int constants ?)


-- Christian