From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id p49EGbkU030603 for ; Mon, 9 May 2011 16:16:37 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4CAIP2x01KfVO2kGdsb2JhbACEUqEdBQgUAQEBAQkJDQcUBCGqAItXCDqCMYRUNohfAQEDBoEgg2CBBgSGHSGJJ4U5hTg7gz4 X-IronPort-AV: E=Sophos;i="4.64,340,1301868000"; d="scan'208";a="82672943" Received: from mail-pv0-f182.google.com ([74.125.83.182]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 09 May 2011 16:16:31 +0200 Received: by pvg11 with SMTP id 11so3719037pvg.27 for ; Mon, 09 May 2011 07:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:message-id:date:from:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=JuDr53OGQ+7QISP3vLLuZ9V9jCOGjQO2eq8gxtlhYvs=; b=dMc8Sfh92RDqV9x2Cj7FdC+ysn6VfCHi6yJfIKdoBOaMDgqNsTc4uqs2TaImgEbyqF Wm8H0NkBammFmD1c5SUD3Kq8ElmqFJY41/eOXafJmSQS+N5vTYKOmZ8YezNMXHRqznrL 67SiJg32JXamUbHUm0z5ln1hOwXp+SFZtFBqs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=S6AM51/7+Dz6/fBNsPPLZeFny0maePcxdcFWVUwf0UWlfSaqX6uxuMFjRHN/obqnnq mw09tQ+v1ZP+N3P5mnuu+DVt7yeo0C8rrhZjZkTrf27nWaa+pMf22Et2cEP+R/H8SGPx 8S8UZrjA6Ru6oKZ7+vqkhpyx7fRKcBRHpUcMI= Received: by 10.142.207.12 with SMTP id e12mr3608494wfg.408.1304950589833; Mon, 09 May 2011 07:16:29 -0700 (PDT) Received: from bobmatoMacBook-Pro.local (tu176104.ip.tsinghua.edu.cn [166.111.176.104]) by mx.google.com with ESMTPS id 25sm8172280wfb.22.2011.05.09.07.16.25 (version=SSLv3 cipher=OTHER); Mon, 09 May 2011 07:16:27 -0700 (PDT) Message-ID: <4DC7F736.6050807@gmail.com> Date: Mon, 09 May 2011 22:16:22 +0800 From: bob zhang User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; zh-CN; rv:1.9.2.17) Gecko/20110414 Thunderbird/3.1.10 MIME-Version: 1.0 To: caml-list@inria.fr, bobzhang1988@gmail.com Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Subject: [Caml-list] two bugs in camlp4? Help!! Hi, all, I am not sure that I made a mistake or two minor bugs in camlp4 revised syntax? Both cases are in toploop, after I type #camlp4r;; #load "camlp4rf.cma"; Register.loaded_modules; - : ref (list string) = {Pervasives.contents= ["Camlp4ListComprenhsion"; "Camlp4MacroParser"; "Camlp4MacroParser"; "Camlp4GrammarParser"; "Camlp4OCamlRevisedParserParser"; "Camlp4QuotationExpander"; "Camlp4OCamlRevisedParser"]} case1: for the signature parsing, when I type value x ~num(num=3) y = num > 0 ; --> value x: ~?num:int -> bool However, the signature can not be parsed by Camlp4 value parse_sig = Camlp4.PreCast.Syntax.(Gram.parse_string sig_item Loc.ghost); parse_sig "value x : ~?num:int -> bool;" will raie an exception however, I tried parse_sig "value x : ?num:int -> bool ;", it's ok, - : Camlp4.PreCast.Syntax.Ast.sig_item = Camlp4.PreCast.Syntax.Ast.SgVal "x" (Camlp4.PreCast.Syntax.Ast.TyArr (Camlp4.PreCast.Syntax.Ast.TyOlb "num" (Camlp4.PreCast.Syntax.Ast.TyId (Camlp4.PreCast.Syntax.Ast.IdLid "int"))) (Camlp4.PreCast.Syntax.Ast.TyId (Camlp4.PreCast.Syntax.Ast.IdLid "bool"))) case 2: when I type module X = struct type a = int and b = (int * int); end; in the toploop module X : sig type a = int; and b = (int * int); end you can see the semi is redudant, it is an error? I thought Camlp4 was heavily used in bootstrapping itself, did I make some stupid assumptions?? Thanks