From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 4D693812FA for ; Wed, 5 Jun 2013 11:52:50 +0200 (CEST) X-IronPort-AV: E=Sophos;i="4.87,804,1363129200"; d="scan'208";a="16839242" Received: from unknown (HELO [10.1.202.3]) ([194.254.61.161]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-CAMELLIA256-SHA; 05 Jun 2013 11:52:50 +0200 Message-ID: <51AF0A71.9020302@inria.fr> Date: Wed, 05 Jun 2013 11:52:49 +0200 From: Romain Bardou User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 MIME-Version: 1.0 To: caml-list@inria.fr References: <51AF09A1.2040002@gmail.com> In-Reply-To: <51AF09A1.2040002@gmail.com> X-Enigmail-Version: 1.4.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Validation-by: romain.bardou@inria.fr Subject: Re: [Caml-list] Ocaml parser reports strange syntax-error position. Le 05/06/2013 11:49, Matej Kosik a écrit : > Hi, > > If I type this to the Ocaml toplevel: > > Printf "%d" 10;; > > The actual problem is that instead of "Printf" I should have typed "Printf.printf". > > However, the parser complains about literal "10". > > Is this the expected behavior or a bug (in parser's error-reporting routines)? > I guess it believes Printf here is not a module name (there is no dot) but a constructor (it is a capitalized identifier). But the syntax for constructors is either: A A x A (x1, ..., xn) In other words, if A is a constructor, "A x y" is never a valid expression. It could also be a type error ("A x" is not a function, it cannot be applied) but apparently it is catched by the parser. So I would say it is the expected behavior, but that it could be improved, as all error messages. -- Romain Bardou