From: Jonathan Protzenko <jonathan.protzenko@gmail.com>
To: caml-list@inria.fr
Subject: [Caml-list] Pippo: a pretty interesting pre-processor that uses OCaml
Date: Tue, 03 Sep 2013 15:14:56 +0200 [thread overview]
Message-ID: <5225E0D0.70305@gmail.com> (raw)
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
<http://caml.inria.fr/pub/ml-archives/caml-list/2009/03/7e9085b8601142024108e254df9dfb1e.en.html>.
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)
next reply other threads:[~2013-09-03 13:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 13:14 Jonathan Protzenko [this message]
2013-09-03 19:19 ` Martin Jambon
2013-09-03 19:21 ` Jonathan Protzenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5225E0D0.70305@gmail.com \
--to=jonathan.protzenko@gmail.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox