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
Syntax highlighting and Ocaml/PHP integration
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-10-01 (15:21)
From: Dario Teixeira <darioteixeira@y...>
Subject: Syntax highlighting and Ocaml/PHP integration

I'm looking for a GPL-compatible syntax highlighting library with support
for most common programming languages and markups.  Obviously I would
prefer a native Ocaml library, though something in C would also be
acceptable due the relative ease of writing bindings.

One library that looks competent is GeSHi [1].  Unfortunately it is
written in PHP.  However, for lack of alternatives, I am looking into
ways of integrating GeSHi with Ocaml.

I reckon that a shell invocation of PHP is straightforward, but I bet
that it would entail a huge performance penalty due to the startup time.
Therefore, I am looking into somehow integrating the PHP interpreter
within the main Ocaml programme.  Something like Apache's mod_php.
Does anyone have any experience with this?  (Note that I have *zero*
experience with PHP).

If all else fails, my backup solution is simply to run a small webserver
with GeSHi and transform the library call into a web service.  Though I
would rather avoid this convoluted option.

Thanks in advance for your input!
Best regards,
Dario Teixeira

P.S.  Another (possibly far-fetched) solution is to take advantage of the
      syntax highlighting capabilities of Vim or Emacs.  Something along
      the lines of embedding or remotely invoking one of these editors,
      with the sole purpose of asking them to highlight a text file.
      Is this even possible?