caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Pippo: a pretty interesting pre-processor that uses OCaml
@ 2013-09-03 13:14 Jonathan Protzenko
  2013-09-03 19:19 ` Martin Jambon
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Protzenko @ 2013-09-03 13:14 UTC (permalink / raw)
  To: caml-list

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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Pippo: a pretty interesting pre-processor that uses OCaml
  2013-09-03 13:14 [Caml-list] Pippo: a pretty interesting pre-processor that uses OCaml Jonathan Protzenko
@ 2013-09-03 19:19 ` Martin Jambon
  2013-09-03 19:21   ` Jonathan Protzenko
  0 siblings, 1 reply; 3+ messages in thread
From: Martin Jambon @ 2013-09-03 19:19 UTC (permalink / raw)
  To: Jonathan Protzenko; +Cc: caml-list

It looks a lot like camlmix :-) (http://mjambon.com/camlmix/)

Martin

On Tue 03 Sep 2013 06:14:56 AM PDT, Jonathan Protzenko wrote:
> 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)
>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Pippo: a pretty interesting pre-processor that uses OCaml
  2013-09-03 19:19 ` Martin Jambon
@ 2013-09-03 19:21   ` Jonathan Protzenko
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Protzenko @ 2013-09-03 19:21 UTC (permalink / raw)
  To: Martin Jambon; +Cc: caml-list

Huh. I wish I'd found that earlier :-). At least I had fun writing it!

~ jonathan

On Tue 03 Sep 2013 09:19:43 PM CEST, Martin Jambon wrote:
> It looks a lot like camlmix :-) (http://mjambon.com/camlmix/)
>
> Martin
>
> On Tue 03 Sep 2013 06:14:56 AM PDT, Jonathan Protzenko wrote:
>> 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)
>>
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-09-03 19:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-03 13:14 [Caml-list] Pippo: a pretty interesting pre-processor that uses OCaml Jonathan Protzenko
2013-09-03 19:19 ` Martin Jambon
2013-09-03 19:21   ` Jonathan Protzenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).