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=HTML_MESSAGE autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id AF601BBCA for ; Fri, 4 Apr 2008 09:59:09 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApsBAN989UdIDtyac2dsb2JhbACCPDaOWgEMAwQFCRSUGoVe X-IronPort-AV: E=Sophos;i="4.25,603,1199660400"; d="scan'208";a="24585035" Received: from fg-out-1718.google.com ([72.14.220.154]) by mail4-smtp-sop.national.inria.fr with ESMTP; 04 Apr 2008 09:59:09 +0200 Received: by fg-out-1718.google.com with SMTP id l27so4033088fgb.43 for ; Fri, 04 Apr 2008 00:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=Mawg/HBaCsPeVZy+K5q3Sf4QcPzUI3RyBjNX+uLFC2s=; b=KXZ5w4K6GmhdOGa0qTk463K2Wf9IDY+k+BCRPGSzOfpUngNWBit29nNlobMfj6nD+fxd2V0ly16iI2phiC0ACIeltjGnn5nF0DFeu3nhp8UUeVGpK29CvpSSTNttWhu/ILdJl1DBaI8Pw1eslJAK3ElC/p5S2SBQVJTfnmaYXJA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=message-id:date:from:to:subject:mime-version:content-type; b=eiZR/RF02a0DBNoKkVK9KV6+TA2J6nWFiHGdi6MVwuIn/xleBIiiWCj6IKsJjH6bxlxdQ9lvgRpxDExaUjhHhltJUncSVC3bbavgbrk77uMVTY8ZwG+SfDrh3YU8wKuhbKfiJ7lTNqm6TfaxbTVFr5S/2I/ND/uWvxkyuj3q+rQ= Received: by 10.86.62.3 with SMTP id k3mr599863fga.24.1207295949054; Fri, 04 Apr 2008 00:59:09 -0700 (PDT) Received: by 10.86.27.12 with HTTP; Fri, 4 Apr 2008 00:59:09 -0700 (PDT) Message-ID: Date: Fri, 4 Apr 2008 08:59:09 +0100 From: "Conglun Yao" To: caml-list@yquem.inria.fr Subject: camlp4 questions MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1469_25037779.1207295949037" X-Spam: no; 0.00; camlp:01 camlp:01 pcaml:01 pcaml:01 strm:01 strm:01 expr:01 expr:01 .....:98 .....:98 grammar:02 grammar:02 append:02 append:02 expression:02 ------=_Part_1469_25037779.1207295949037 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, While doing my little camlp4 (3.10) practice, I had the following questions: (1) Is there a simple approach to add some 'open' directive at the beginning of file. I know in camp4 (3.09), it could be achieved by modifying Pcaml.parse_implem. Pcaml.parse_implem := fun strm -> let (sils, stopped) = Grammar.Entry.parse Pcaml.implem strm in let enhanced_sils = ..... (* modify sils *) (enhanced_sils, stopped); How can I achieve the same effect in 3.10. (2) How to extend operators like '@', for example if I want to change the expression list_1 @ list_2 => List.append list_1 list_2 In 3.09, it could be achieved by deleting rules DELETE_RULE Gram expr: SELF; "@"; SELF END however, in 3.10, it seems I can't find the above grammar, only can find in Camlp4OCamlParser.ml expr: AFTER "^" [ "::" RIGHTA [ e1 = SELF; "::"; e2 = SELF -> <:expr< [$e1$ :: $e2$] >> ] ]; Furthermore, if I want to extend the expr: "["; sem_expr_for_list; "]", where to find the rule definition. In 3.09, all of these exist in pa_o.ml Any suggestion is welcome and appreciated. Conglun ------=_Part_1469_25037779.1207295949037 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi,

While doing my little camlp4 (3.10) practice, I had the following questions:

(1) Is there a simple approach to add some 'open' directive at the beginning of file.
I know in camp4 (3.09), it could be achieved by modifying Pcaml.parse_implem.

Pcaml.parse_implem :=
fun strm ->
let (sils, stopped) = Grammar.Entry.parse Pcaml.implem strm in
let enhanced_sils = ..... (* modify sils *)
(enhanced_sils, stopped);

How can I achieve the same effect in 3.10.

(2) How to extend operators like '@', for example if I want to change the expression
list_1 @ list_2 => List.append list_1 list_2

In 3.09, it could be achieved by deleting rules
DELETE_RULE Gram expr: SELF; "@"; SELF END

however, in 3.10, it seems I can't find the above grammar, only can find in Camlp4OCamlParser.ml
expr: AFTER "^"
[ "::" RIGHTA
[ e1 = SELF; "::"; e2 = SELF -> <:expr< [$e1$ :: $e2$] >> ]
];

Furthermore, if I want to extend the expr: "["; sem_expr_for_list; "]", where to find the rule definition.
In 3.09, all of these exist in pa_o.ml

Any suggestion is welcome and appreciated.

Conglun ------=_Part_1469_25037779.1207295949037--