From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA03007; Thu, 6 Sep 2001 11:46:47 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-announce@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA03109 for caml-announce@pauillac.inria.fr; Thu, 6 Sep 2001 11:46:47 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA20896 for ; Wed, 5 Sep 2001 15:54:17 +0200 (MET DST) Received: from chopin.ai.univie.ac.at (chopin.ai.univie.ac.at [131.130.174.170]) by nez-perce.inria.fr (8.11.1/8.10.0) with ESMTP id f85DsHn10268 for ; Wed, 5 Sep 2001 15:54:17 +0200 (MET DST) Received: (from markus@localhost) by chopin.ai.univie.ac.at (8.9.3/8.9.3/Debian 8.9.3-21) id PAA22728 for caml-announce@inria.fr; Wed, 5 Sep 2001 15:54:16 +0200 Date: Wed, 5 Sep 2001 15:54:16 +0200 From: Markus Mottl To: caml-announce Subject: [Caml-announce] new OcamlMakefile with preprocessing support Message-ID: <20010905155416.A22112@chopin.ai.univie.ac.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i Sender: owner-caml-announce@pauillac.inria.fr Precedence: bulk Hello, I have just released a new major version (3.00) of OcamlMakefile. The most important new feature is support for automatic preprocessing. But be aware that it requires OCaml-3.03, which has not yet been released! The current CVS-version of OCaml already incorporates the necessary change, i.e. a -pp flag for ocamldep. If you feel daring, check out the CVS-version of OCaml, otherwise wait until the new version is released (will probably not take too long, it seems). You can get OcamlMakefile here: http://www.ai.univie.ac.at/~markus/home/ocaml_sources.html To quickly demonstrate its new capabilities, let's take a look at the new example in the distribution, which implements the "repeat ... until" construct as described in the camlp4-tutorial: file: main.ml --------------------------------------------------------------------------- (*pp camlp4o -I . repeat_syn.cmo *) let _ = let i = ref 0 in repeat print_int !i; incr i until !i = 10; print_newline () --------------------------------------------------------------------------- The first line in the upper file tells OcamlMakefile how to run the preprocessor. file: repeat_syn.ml --------------------------------------------------------------------------- (*pp camlp4o pa_extend.cmo q_MLast.cmo *) open Pcaml;; EXTEND expr: LEVEL "top" [[ "repeat"; e1 = expr; "until"; e2 = expr -> <:expr< do { $e1$; while not $e2$ do { $e1$; } } >> ]]; END --------------------------------------------------------------------------- Here, too, we need the preprocessor to implement the new construct. Finally, here is the Makefile (assuming that OcamlMakefile is visible to "make"): file: Makefile --------------------------------------------------------------------------- SOURCES := main.ml PRE_TARGETS := repeat_syn.cmi repeat_syn.cmo USE_CAMLP4 := yes RESULT := main -include OcamlMakefile --------------------------------------------------------------------------- Then just enter "make"... All the other "make"-targets, e.g. for building native code libraries, byte code with debug information, etc., all work as usual. This seems to be about as simple as it can get. I hope this will make the complexity of correctly applying camlp4 (or other preprocessors) less of an obstacle to developers who want to learn implementing syntax extensions. Thanks to all people on the list who gave me advice on how to best implement this feature into OcamlMakefile! Have fun! Best regards, Markus Mottl -- Markus Mottl markus@oefai.at Austrian Research Institute for Artificial Intelligence http://www.oefai.at/~markus