From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 2FA3FBC57 for ; Thu, 23 Sep 2010 16:56:12 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: At4BAF4Hm0zRVdI2kGdsb2JhbACUOo1uCBUBAQEBCQkMBxEDH6sXiT2CFIZQLohVAQEDBYU8BIUEhTQ X-IronPort-AV: E=Sophos;i="4.57,223,1283724000"; d="scan'208";a="64288985" Received: from mail-pz0-f54.google.com ([209.85.210.54]) by mail2-smtp-roc.national.inria.fr with ESMTP; 23 Sep 2010 16:56:11 +0200 Received: by pzk7 with SMTP id 7so572199pzk.27 for ; Thu, 23 Sep 2010 07:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:content-type; bh=CkD/5wdlzF3BP7DpNhitpoOJn4vwLAMu1m06kU3p2HY=; b=mFGbj4tRVgGxe8v62RQepHhJmb2WyEQWwRmrWu3aTU3sAZc5eVYZhWKEFpFx0ZXnsQ w7Xtz5bnTlYjjxDlDEbOL//IOpm8JZXt8d+N3cPCmqgLLggfab65xXjWxreBARqLVMWQ PROIjelxN0iVaed/V2ScZo30serjcs1cwPRuM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=JfVYKvE37rO2gp+feVXGkY37i9I4oOMdvhhBHd/kWMp5b292ZaZ0XHT8VZ050jpLV8 l7W7Yd0lkNz2BXbim2+RNfqLsq7g++3OToElKiMhTEX47NinzaCUdBwQCyMLje/fGnCS DtSTJZNbw+zoie/za540C4tEtZ2ko7AjuFGHY= MIME-Version: 1.0 Received: by 10.114.67.14 with SMTP id p14mr1914152waa.144.1285253763739; Thu, 23 Sep 2010 07:56:03 -0700 (PDT) Received: by 10.231.212.216 with HTTP; Thu, 23 Sep 2010 07:56:03 -0700 (PDT) Date: Thu, 23 Sep 2010 16:56:03 +0200 Message-ID: Subject: what do I need to know to understand camlp4 From: ben kuin To: caml-list@inria.fr Content-Type: text/plain; charset=ISO-8859-1 X-Spam: no; 0.00; camlp:01 ocaml:01 syntax:01 wiki:01 camlp:01 syntax:01 imperative:01 int:01 int:01 ast:02 declaration:02 let:03 let:03 extension:06 concrete:08 hi I'm a Ocaml n00b (without any degree). Therefore I have a faible for everything that makes Ocamls syntax more algol/imperative like [1]. An example would be an extension like 'newref' (http://bitbucket.org/johannes/newref/wiki/Home), which turns: print_int !i into print_int $i (* newref *) so I fiercely try to also perlify the declaration that turns let i = ref 3 into let $i = 3 (* my idea ... *) but camlp4 makes my head spin. The syntax is very difficult and in a lot of camlp4 documentation there is AST modification involved, which is a subject I don't get although I made several attempts. And simple program transformation with camlp4 (using concrete syntax) is nowhere documented. Could someone give any idea how I can begin to understand how to write simple camlp4 extensions? thanks ben [1] please don't kill me