From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id B81C5820A4 for ; Tue, 3 Sep 2013 15:17:10 +0200 (CEST) Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of jonathan.protzenko@gmail.com) identity=pra; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jonathan.protzenko@gmail.com"; x-sender="jonathan.protzenko@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail3-smtp-sop.national.inria.fr: domain of jonathan.protzenko@gmail.com designates 209.85.214.45 as permitted sender) identity=mailfrom; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jonathan.protzenko@gmail.com"; x-sender="jonathan.protzenko@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-bk0-f45.google.com) identity=helo; client-ip=209.85.214.45; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="jonathan.protzenko@gmail.com"; x-sender="postmaster@mail-bk0-f45.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: As4BAODgJVLRVdYtk2dsb2JhbABagzyDeL51Fg4BAQEBBwsLCRQEJIJOBBkBGx4DEhAPAgUhAhECEhEBBQEvCAEBh2sBAw8MmEyDAIt/UYMFhBYKGScNZIdnAQUMgR2OaoJTgTQDl3WBL4R9iVFBhEo X-IPAS-Result: As4BAODgJVLRVdYtk2dsb2JhbABagzyDeL51Fg4BAQEBBwsLCRQEJIJOBBkBGx4DEhAPAgUhAhECEhEBBQEvCAEBh2sBAw8MmEyDAIt/UYMFhBYKGScNZIdnAQUMgR2OaoJTgTQDl3WBL4R9iVFBhEo X-IronPort-AV: E=Sophos;i="4.89,1014,1367964000"; d="scan'208";a="25572787" Received: from mail-bk0-f45.google.com ([209.85.214.45]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 03 Sep 2013 15:17:08 +0200 Received: by mail-bk0-f45.google.com with SMTP id mx11so2087347bkb.18 for ; Tue, 03 Sep 2013 06:17:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=cBNtFbZcKCFbMtiQ4TegAbkS7HoVB5iwhXfWW213yPY=; b=l03x4PKNf833EEuBxTtF9lfzVatIo2DVvKSAxllN3ud+0uu91z43gctE9v10cTAkU3 kc5dskePZ68r0F8SHzT0m6VP32FRMmvWg7ZuVF1nBDiV7ql1a94rGL+Hfu11soxMTvAh oDWKXHthxOUiyzet016ZAk6MEEZStqlYS2PhOU/072aeaewlZiMhD8qoYZXBTYZfS7gc R2V+WzcglO6axsolWphmN+ZJd2vBpqt289ASYmDoXpOKaqjVGwSWryg7/I/WJbtdF507 FonvPpb4NWog6zYzkJ4kp5YbIGYEYYm0z/mVjwq3YER2dJUm7KyHx3IaI0m7VdrhT3Ap DMgA== X-Received: by 10.205.24.131 with SMTP id re3mr21602648bkb.8.1378214227889; Tue, 03 Sep 2013 06:17:07 -0700 (PDT) Received: from [128.93.11.91] (sauternes.inria.fr. [128.93.11.91]) by mx.google.com with ESMTPSA id od6sm4604218bkb.11.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Sep 2013 06:17:06 -0700 (PDT) Message-ID: <5225E0D0.70305@gmail.com> Date: Tue, 03 Sep 2013 15:14:56 +0200 From: Jonathan Protzenko User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:26.0) Gecko/20100101 Thunderbird/26.0a1 MIME-Version: 1.0 To: caml-list@inria.fr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: [Caml-list] Pippo: a pretty interesting pre-processor that uses OCaml Hi, Following yesterday's discussion, and using that as a pretext for writing my own tool, here's yet another pre-processor-sort-of. https://github.com/protz/pippo It requires OCaml 4.01.0rc1. The documentation for it is, of course, pre-processed using Pippo. It is distributed with a Makefile that allows you to recompile the documentation and thus play with the tool. It works as described in yesterday's thread: anything found between {% and %} is fed to an OCaml interactive session. Therefore, the output of the OCaml commands is interleaved with the non-OCaml parts of the file. Basically, the tool allows you to script your documents easily. The tool also contains a special "inject_value" facility, that allows you to make any OCaml value (constant, function) available in the top-level session. For instance, running: inject_value "__version" "unit -> unit" (fun () -> print_endline "This is pippo v0.1"); will allow you to write, in the to-be-pre-processed document : {% __version (); %} For the record, the question (how do I use Toploop.setvalue) was asked a few years ago but left unanswered . The OCaml maintainers should probably not look at the implementation, by the way. Cheers, ~ jonathan PS: My warmest thanks go to Thomas Braibant for helping me find a name with a pun (in French)