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 mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id A5309BC69; Mon, 24 Sep 2007 19:39:15 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAABOT90bAXQInemdsb2JhbACOGgIJCg X-IronPort-AV: E=Sophos;i="4.20,292,1186351200"; d="scan'208";a="1371916" Received: from concorde.inria.fr ([192.93.2.39]) by mail1-smtp-roc.national.inria.fr with ESMTP; 24 Sep 2007 19:39:15 +0200 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l8OHdEEE004695 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK); Mon, 24 Sep 2007 19:39:15 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAIyT90bLENaMnmdsb2JhbACOGwIBAQcEBg8Y X-IronPort-AV: E=Sophos;i="4.20,292,1186351200"; d="scan'208";a="16708120" Received: from ipmail01.adl2.internode.on.net ([203.16.214.140]) by mail4-smtp-sop.national.inria.fr with ESMTP; 24 Sep 2007 19:39:02 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgAAAG2S90Z5LHvc/2dsb2JhbAAM X-IronPort-AV: E=Sophos;i="4.20,292,1186324200"; d="scan'208";a="196807023" Received: from ppp121-44-123-220.lns10.syd6.internode.on.net (HELO [192.168.1.201]) ([121.44.123.220]) by ipmail01.adl2.internode.on.net with ESMTP; 25 Sep 2007 03:08:54 +0930 Subject: Re: [Caml-list] ocamlbuild: args to tags? From: skaller To: Nicolas Pouillard Cc: caml-list , "jake.donham" In-Reply-To: <1190644392-sup-9865@ausone.inria.fr> References: <46F01294.7060806@skydeck.com> <1190636327-sup-9586@ausone.inria.fr> <1190642617.6025.9.camel@rosella.wigram> <1190644392-sup-9865@ausone.inria.fr> Content-Type: text/plain Date: Tue, 25 Sep 2007 03:38:53 +1000 Message-Id: <1190655533.6047.27.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 46F7F642.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0200,:01 ocaml:01 syntax:01 syntax:01 annotations:01 annotations:01 ocaml:01 mli:01 parser:01 literals:01 camlp:01 camlp:01 -pp:01 parser:01 ocamldoc:01 On Mon, 2007-09-24 at 17:23 +0200, Nicolas Pouillard wrote: > > (* My Ocaml File .. *) > > (*#Syntax Mycamlp4syn *) (* for compatibility *) > > #syntax Mycamlp4syn; (* better *) > > This sounds like a good idea. That's not a new one and it was our first > choice when designing ocamlbuild. However after some reflections we decided > that one can first do _tags method and then provide a way to read tags from > the file itself. There's slight difference in view as expressed here. I wouldn't suggested arbitrary "tags" or hints be first class syntax (although one might put them in comments). I'm not against tags annotations.. I'm suggesting the specification of the syntax extension doesn't belong on the command line, or in a tags file, it belongs in the file. > The main problem with the solution with embedded tags is that one must at > least define a how to read these annotations. This is not that easy since a > .ml file can be a pre-processed file with a totally different syntax. No, this should not be allowed: that's my point. Every Ocaml file uses THE syntax for either *.mli or *.ml, end of story. If it uses some other language, it should have a different extension. However the syntax can be extensible, but the extensions must be at least loaded, if not defined, IN the file. Felix does this. It uses Dypgen GLR parser and OCS Scheme to implement it. You have to say: open syntax felix; or you can't parse anything except syntax extensions :) The whole of the language proper (except nonterminals mapped to terminals such as literals) is specified by a dynamically specified grammar. In Felix, you can extend the grammar 'anywhere', the extensions are properly scoped. So actually, there's no problem designing a syntax which allows loading another syntax, that is, a bootstrap syntax. For Ocaml, you could easily add a directive open syntax Mysyntax or #syntax Mysyntax to the standard grammar, and make camlp4 parse it and use it to load syntax extensions. Running camlp4 so this happens should be the mandatory, no -pp command stuff: camlp4 IS the Ocaml parser. Then, when you run, say, ocamldoc, it knows which extensions to load, as does the human reader. It's just the same as let (@) f g x = f (g x) The "syntax extension" of the user defined operator @ for composition is defined IN the program. -- John Skaller Felix, successor to C++: http://felix.sf.net