From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 53113BC6C for ; Tue, 26 Jun 2007 22:48:22 +0200 (CEST) Received: from smtp116.sbc.mail.sp1.yahoo.com (smtp116.sbc.mail.sp1.yahoo.com [69.147.64.89]) by concorde.inria.fr (8.13.6/8.13.6) with SMTP id l5QKmKaD001697 for ; Tue, 26 Jun 2007 22:48:21 +0200 Received: (qmail 50970 invoked from network); 26 Jun 2007 20:48:19 -0000 Received: from unknown (HELO ?192.168.1.100?) (rftp@pacbell.net@69.230.209.222 with plain) by smtp116.sbc.mail.sp1.yahoo.com with SMTP; 26 Jun 2007 20:48:19 -0000 X-YMail-OSG: LyI2TgoVM1l72y6pBoz1RmqAGkuri9x5YJVd9sskbXEbbLri.IT4AHuwHq5DVv8V_O5bpnenS5MoT98R28qF4Opd8lJ6m_O2_TTRej.OQOn6w2Ptpg-- Message-ID: <46817B89.30004@rftp.com> Date: Tue, 26 Jun 2007 13:48:09 -0700 From: Robert Roessler User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a6pre) Gecko/20070623 SeaMonkey/2.0a1pre MIME-Version: 1.0 To: Caml-list Subject: Re: [Caml-list] Float literals References: <46817245.4020305@gmail.com> In-Reply-To: <46817245.4020305@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 46817B94.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; literals:01 notation:01 lexing:01 literals:01 lexer:01 'l':01 'l':01 'n':01 edgar:98 parsed:01 token:01 wrote:01 precedence:01 integer:01 integer:01 Edgar Friendly wrote: > 1e6 (* an integer? no, a float without a . Problem.*) > 13 (* valid as a float, according to the above definition *) > > Does anyone else find the last two cases kind of odd? Maybe it's not a > big deal because the 1e6 is scientific notation, which is float-y, and > the last one is always parsed as an integer, I assume because of > precedence in the lexing functions. There isn't (to me) anything weird about this... from 6.1 in the reference manual on "Floating-point literals": "The decimal part or the exponent part can be omitted, but not both to avoid ambiguity with integer literals." And, as you suggest, in practice it isn't an issue either - a lexer will try to see a numeric literal as an int as long as it legally still can constitute an int. But assuming we are still recognizing a base 10 literal, a *letter* that isn't 'l', 'L', or 'n' had better be an 'e' or 'E' (so that it may still be a float)... or you have an invalid token. ;) Robert Roessler roessler@rftp.com http://www.rftp.com