English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
camlp4 beta
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-05-29 (20:45)
From: Jeff Henrikson <jehenrik@y...>
Subject: camlp4 beta

Glad to see camlp4 getting an upgrade.  I have written several simple 
extensions in the old camlp4 but I can't seem to make your new examples 


Is the beta currently capable of running in a toplevel?  I downloaded 
the 3.10+... tarball, compiled and installed, and ran various 
permutations of:

#load "camlp4o.cma";;
#directory "+camlp4";;
#directory "+camlp4/Camlp4Top";;
#directory "+camlp4/Camlp4Parsers";;
#load "Camlp4Top.cmo";;
#load "grammar.cmo";;
#load "Camlp4o.cmo";;

open Camlp4.Entry;;
open Camlp4.Grammar;;
open Camlp4.PreCast;;
open Syntax;;

And then ran each example.  I have no idea what I'm doing here with all 
the directories and uppercase filenames.  I thought ocaml broke weirdly 
with leading upper case filenames.  Example problem I am having with 
with dynamic_old_syntax.ml  Unbound identifier Entry.mk.  I can't find 
how to load the new definition of Entry.mk.  In the old ocaml you just 
needed #load "camlp4o.cma" I believe.

Are all the code examples *supposed* to run?  It's not clear by simple 
visual inspection of the doc some of them are only for the old 
framework.  Then there's that (...) notation, which looks like "put 
special module here".  Being literal in the docs about which examples 
run, and which don't is a necessity, IMHO.  Also, if applicable, their 
respective camlp4 versions and a list of any code additions which are 
necessary to get the examples to run.

A weakness of the old camlp4 was just getting it configured.  I like the 
-printer -filter, etc switches are the right direction.  But I mostly 
write my macros in the toplevel.  Some simple "enter these lines into 
the toplevel and it will work" examples might be in order?

As far as architectural choices, and I can't tell if you've handled this 
without actually running your exmaples and making sense of them, I would 
like the ability to quote/print *unexpanded* macros.  This was not to my 
knowledge possible in the old camlp4.  For example, if I extend the 
traditional caml syntax with a for loop, even though I am defining for 
in terms of a transformation to regular caml, I want to be able to read 
a block of text into an AST with a production for the for loop.  A 
killer app would be an eclipse plugin which could indent all possible 
Camlp4 grammars.  Not only would there finally be support for revised 
syntax, but removing the emacs mode as the only supported indenting 
could significantly expand the ocaml community.  At my last job I was 
giving an ocaml tutorial to a non-emacsy coworker, and at the point 
where it got to all the bizarre emacs lore hotkeys, I had this feeling 
like *why* do I bother.  And Eclipse support for each new DSL that I do, 
for free?  That would be amazing.

Sorry for taking a couple of weeks to take a look.  Best wishes 
finishing up your internship.

Jeff Henrikson