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=1.9 required=5.0 tests=AWL,DNS_FROM_RFC_POST, SPF_NEUTRAL autolearn=disabled version=3.1.3 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 69122BBC4 for ; Thu, 2 Apr 2009 13:42:19 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AiECAKhB1EnRVdq0kGdsb2JhbACVVj8BAQEBCQkMBxEDqAyBCJAdAQMBA4N6Bg X-IronPort-AV: E=Sophos;i="4.38,431,1233529200"; d="scan'208";a="26876648" Received: from mail-bw0-f180.google.com ([209.85.218.180]) by mail1-smtp-roc.national.inria.fr with ESMTP; 02 Apr 2009 13:42:19 +0200 Received: by bwz28 with SMTP id 28so522811bwz.27 for ; Thu, 02 Apr 2009 04:42:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=W8KfFzZZ7GZ5D+n7dGul51B9qtoT78s3+tFHEE14OgA=; b=A/F15e8BAFWXeiUYYn34bwvPKJqABLYOSxPn0M0gZGJ0RY0XK5HjYRXqAOVCphBvin VpNtkioTe8uYdqtuKekmcsrL+3uMgnxb0tzRbgZjwhQaRfiCopUHBonQttIMJkOzuV1p M1HLtGPVnKPmo63D6lARhm5xZUg/GPl/gr3bc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=aumt/GuCyMZCciQiqADu7R6pAhKiF+dA9RS/8fdVReUoR8u5eIDMOHMPYNxGZlctdZ QjgW/VYXx4pPjS/sHaX3A8xfdvr2CVgyTqcqhFoQhtKt5IEzleJSAZP+DTiQPC1M0Su4 YGC+9b/tD6iWAx870I+ltFo1phJAvFEoSaPhM= MIME-Version: 1.0 Received: by 10.103.239.10 with SMTP id q10mr3369336mur.67.1238672538443; Thu, 02 Apr 2009 04:42:18 -0700 (PDT) Date: Thu, 2 Apr 2009 12:42:18 +0100 Message-ID: Subject: How to achieve this camlp4 syntax extension From: Conglun Yao To: caml-list@yquem.inria.fr Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; camlp:01 syntax:01 syntax:01 expr:01 expr:01 longident:01 'list':01 longident:01 parsed:01 expression:02 expression:02 defined:02 match:02 module:03 module:03 Dear all, I tried to achieve the following syntax extension, but failed. Add expression .[ ] after a module name, inside .[ ] I want to refer to the specified module, like let _ = M1.M2.[ here is my syntax, using M1.M2 module ] Here is my attempt (failed) EXTEND Gram GLOBAL: expr; expr: LEVEL "top"[ [ e1 = module_longident; "."; "["; (*t = test_syntax;*) "]" -> <:expr< $id:e1$ test >> ]]; END Different kinds of error happened, when trying to use it. Even the ordinary expression: List.length [1; 2;3 ], failed. 'List' is parsed as module_longident, try to match the rule I defined. Thanks for any help. Conglun