Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Camlp4 in a Unix pipe
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-11-17 (14:20)
From: Alessandro Baretta <a.baretta@b...>
Subject: Camlp4 in a Unix pipe
I'm musing a little with camlp4. Specifically, I'm trying to get it to 
preprocess input written according to some syntax extension and output the 
result. Of course, since I'm just playing, I'd like to do this in type-eval-loop 
kind of interface. I tried typing the following command in my shell:

$ cat - | camlp4 pa_o.cmo pa_extend.cmo pr_o.cmo pa_openin.cmo

Camlp4 dies miserably discarding it's standard input. So then I tried the following:

cat - | camlp4 pa_o.cmo pa_extend.cmo pr_o.cmo pa_openin.cmo -impl /dev/stdin

Again, camlp4 dies miserably with the following error message:
I/O error: Illegal seek

Short of writing my own Pr_stdout module, is there any way to achieve the result 
of interactively getting camlp4 to preprocess some code and print it back to stdout?