Negative float consts

From: Christian Boos (boos@arthur.u-strasbg.fr)
Date: Tue Jan 14 1997 - 17:19:19 MET


Date: Tue, 14 Jan 1997 17:19:19 +0100
Message-Id: <199701141619.RAA12012@arthur.u-strasbg.fr>
From: Christian Boos <boos@arthur.u-strasbg.fr>
To: caml-list@inria.fr
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



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:09 MET