From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA00360; Thu, 5 Apr 2001 19:34:19 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA00197 for ; Thu, 5 Apr 2001 19:34:18 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f35HYFv04543; Thu, 5 Apr 2001 19:34:15 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA00305; Thu, 5 Apr 2001 19:34:16 +0200 (MET DST) From: Pierre Weis Message-Id: <200104051734.TAA00305@pauillac.inria.fr> Subject: Re: [Caml-list] semi-colons and begin In-Reply-To: from Mattias Waldau at "Apr 5, 101 08:23:01 am" To: mattias.waldau@abc.se (Mattias Waldau) Date: Thu, 5 Apr 2001 19:34:16 +0200 (MET DST) Cc: caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > There are a lot of problems with the Caml-syntax and I can live with the > most > ones. I am really glad that Emacs indents correctly, and that makes the > following [...] > My biggest problem is when the syntax error occurs in a completely different > location in the file, because it makes finding the bugs very difficult. > (I understand why the typechecker sometimes complains at the source, > sometimes > and the destination). Whould it be possible to pinpoint the error more > exactly > or is there a reason that in > > let _ = 1+2; > > let _ = 2 > > let _ = 4 > > we get a syntax error at the last 'let'? > > /mattias > > ------------------- > To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr The reason is that your set of phrases let _ = 1+2; let _ = 2 let _ = 4 is understood as a single definition of a sequence expression as: let _ = 1 + 2; let _ = 2 let _ = 4 hence the second ``let'' is is a local definition that needs an in part that is lacking. Hence, the syntax error on the third let (the parser is waiting for an ``in'' keyword, and finding ``let'' triggers the syntax error). The problem here is that there is no end-of-phrase marks that would prevent the parser from shifting for ever. Hence, using explicit ends of phrase here would be less error prone, although arguably a bit more heavy since you would have to write: 1+2;; 2;; 4;; On the other hand, you get rid of the ``let _ ='' Objective Caml supports those two styles, so you can choose the style you prefer. Hope this helps, Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr