* camlp4
@ 2010-02-06 1:16 Andy Ray
2010-02-06 11:15 ` [Caml-list] camlp4 blue storm
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Andy Ray @ 2010-02-06 1:16 UTC (permalink / raw)
To: caml-list
Hi,
My project would really benefit from some simple camlp4 syntax
extensions, however, I am put off by the lack of a reference manual
for it.
At the moment I am tempted to go for camlp5 instead - not least
because I was able to work through it's manual and get some examples
working a while back.
The reality is I would prefer to use camlp4 as it appears to the
official ocaml supported way, but can't see how to get into it as a
beginner due to the lack of documentation (and that appears to have
been the case for quite some time now). What should one do?
Cheers,
Andy
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Caml-list] camlp4
2010-02-06 1:16 camlp4 Andy Ray
@ 2010-02-06 11:15 ` blue storm
2010-02-06 12:14 ` Tiphaine Turpin
` (2 subsequent siblings)
3 siblings, 0 replies; 15+ messages in thread
From: blue storm @ 2010-02-06 11:15 UTC (permalink / raw)
To: Andy Ray; +Cc: caml-list
[-- Attachment #1: Type: text/plain, Size: 309 bytes --]
- There is some documentation there :
http://brion.inria.fr/gallium/index.php/Camlp4
- If what you want is really simple, you can probably hack it from one of
the camlp4 extensions around
- If what you want is really simple, you could describe it; I know Camlp4
and would be glad to contribute something easy
[-- Attachment #2: Type: text/html, Size: 381 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Caml-list] camlp4
2010-02-06 1:16 camlp4 Andy Ray
2010-02-06 11:15 ` [Caml-list] camlp4 blue storm
@ 2010-02-06 12:14 ` Tiphaine Turpin
2010-02-06 12:44 ` Guillaume Yziquel
2010-02-07 17:19 ` Martin DeMello
2010-02-06 13:37 ` Ed Keith
2010-02-07 13:51 ` [Caml-list] camlp4 Joseph Young
3 siblings, 2 replies; 15+ messages in thread
From: Tiphaine Turpin @ 2010-02-06 12:14 UTC (permalink / raw)
To: caml-list
Andy Ray a écrit :
> What should one do?
>
Complaining on the list about lack of camlp4 documentation is a good
start :-). To help you decide (and increase the pressure on the Ocaml
team), I would like to mention some of the difficulties that I
encountered when trying to understand camlp4 as a user:
- no overview of the organisation of the code (and no API either)
- the source folder tree is deep, and thus harder to grep
- the heavy use of functors obfuscates the dependencies (This is not a
remark against the design choice, but on readability in the absence of
documentation). Once you have found the implementation or interface of a
function that you need, you still have to find the path to the
appropriate module in PreCast which has it.
- a lot of .cmo and .cma, but what are their repective purposes ? This
is addressed in the wiki for the syntax extension part, but linking a
standalone program which uses camlp4 (even PreCast) to parse source
files is not so easy.
That being said, whith the wiki (whose structure is terrible) and a few
other google-suggested sources, you will get most of the informations
needed for the simplest use (syntax extension). Still, for a few grammar
entries, antiquotation names, and all basic manipulation functions
(locations, idents, etc.), you are on your own.
Two more links:
http://nicolaspouillard.fr/camlp4-changes.html
http://www.ocaml-tutorial.org/camlp4_3.10
Tiphaine
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Caml-list] camlp4
2010-02-06 12:14 ` Tiphaine Turpin
@ 2010-02-06 12:44 ` Guillaume Yziquel
2010-02-09 15:30 ` Guillaume Yziquel
2010-02-07 17:19 ` Martin DeMello
1 sibling, 1 reply; 15+ messages in thread
From: Guillaume Yziquel @ 2010-02-06 12:44 UTC (permalink / raw)
To: Tiphaine Turpin; +Cc: caml-list
Tiphaine Turpin a écrit :
> Andy Ray a écrit :
>> What should one do?
>>
> Complaining on the list about lack of camlp4 documentation is a good
> start :-). To help you decide (and increase the pressure on the Ocaml
> team), I would like to mention some of the difficulties that I
> encountered when trying to understand camlp4 as a user:
I fully agree. I've been working on understanding Camlp4 recently to
handle one of Mauricio Fernandez' library on relational algebras.
You can, eventually, if you take time, get to understan how everything
works out. But that involves a lot of trial and error, and I still
believe I do not have the full picture in mind.
I'd just keep two things in mind concerning camlp4:
-1- It's not hugely different from Camlp5. It is different, but not
hugely, at least from the newcommer's point of view. So my advice is
simply to work on an existing camlp4 extension, and to try groking with
existing camlp5 documentation, while doing trials and errors the whole
way long. It is painful, but it's doable.
-2- A good hands-on introduction, to be read in conjunction with
up-to-date camlp4 code:
http://martin.jambon.free.fr/extend-ocaml-syntax.html
Now, if someone, or a group of people, has the courage to update
Martin's page to the current camlp4, that would be hugely helpful: I'm
pretty sure there's quite a lot of people willing to use camlp4 that are
simply laid back by the lack of documentation.
Concerning the functorial design of the source code of camlp4, I fully
agree with Tiphaine. It is probably a good design choice, and when you
get to study it closely, it is quite remarkably done. However, a *huge*
pain to read and to navigate through.
All the best,
--
Guillaume Yziquel
http://yziquel.homelinux.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Caml-list] camlp4
2010-02-06 1:16 camlp4 Andy Ray
2010-02-06 11:15 ` [Caml-list] camlp4 blue storm
2010-02-06 12:14 ` Tiphaine Turpin
@ 2010-02-06 13:37 ` Ed Keith
2010-02-06 16:25 ` camlp4 Chris Conway
2010-02-07 13:51 ` [Caml-list] camlp4 Joseph Young
3 siblings, 1 reply; 15+ messages in thread
From: Ed Keith @ 2010-02-06 13:37 UTC (permalink / raw)
To: caml-list, Andy Ray
--- On Fri, 2/5/10, Andy Ray <evilkidder@googlemail.com> wrote:
> From: Andy Ray <evilkidder@googlemail.com>
> Subject: [Caml-list] camlp4
> To: caml-list@inria.fr
> Date: Friday, February 5, 2010, 8:16 PM
> Hi,
>
> My project would really benefit from some simple camlp4
> syntax
> extensions, however, I am put off by the lack of a
> reference manual
> for it.
>
> At the moment I am tempted to go for camlp5 instead - not
> least
> because I was able to work through it's manual and get some
> examples
> working a while back.
>
> The reality is I would prefer to use camlp4 as it appears
> to the
> official ocaml supported way, but can't see how to get into
> it as a
> beginner due to the lack of documentation (and that appears
> to have
> been the case for quite some time now). What should
> one do?
>
I wrestled with this myself and finally decided to stick with camlp5 until there is documentation available for camlp4.
It appears to me that they are similar enough that skills with camlp5 will be transferable to camlp4 when documents becomes available.
-EdK
Ed Keith
e_d_k@yahoo.com
Blog: edkeith.blogspot.com
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: camlp4
2010-02-06 13:37 ` Ed Keith
@ 2010-02-06 16:25 ` Chris Conway
0 siblings, 0 replies; 15+ messages in thread
From: Chris Conway @ 2010-02-06 16:25 UTC (permalink / raw)
To: caml-list
Ed Keith <e_d_k <at> yahoo.com> writes:
> I wrestled with this myself and finally decided to stick with camlp5 until
> there is documentation available for camlp4.
This nails it. I can't believe how many "eat your spinach" replies there
have been to this question. There is no reason whatever to waste your time
figuring out how to use campl4 (post-3.10) when there is a well documented
and widely used alternative. camlp5 may not be the "official" INRIA-blessed
standard, but it has a significant community behind it and is actively
maintained.
-Chris
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Caml-list] camlp4
2010-02-06 1:16 camlp4 Andy Ray
` (2 preceding siblings ...)
2010-02-06 13:37 ` Ed Keith
@ 2010-02-07 13:51 ` Joseph Young
3 siblings, 0 replies; 15+ messages in thread
From: Joseph Young @ 2010-02-07 13:51 UTC (permalink / raw)
To: Andy Ray; +Cc: caml-list
On Sat, 6 Feb 2010, Andy Ray wrote:
> Hi,
>
> My project would really benefit from some simple camlp4 syntax
> extensions, however, I am put off by the lack of a reference manual
> for it.
>
> At the moment I am tempted to go for camlp5 instead - not least
> because I was able to work through it's manual and get some examples
> working a while back.
>
> The reality is I would prefer to use camlp4 as it appears to the
> official ocaml supported way, but can't see how to get into it as a
> beginner due to the lack of documentation (and that appears to have
> been the case for quite some time now). What should one do?
>
> Cheers,
> Andy
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
Though slightly tangental, I use both camlp4 and camlp5 for the
quotation system. As already mentioned, the lack of documentation is a
problem, but it is not insurmountable. At this point, I prefer camlp4 to
camlp5 for the following reasons. First, I like how locations are handled
in camlp4 as opposed to camlp5. In camlp4, a function registered as a
quotation accepts a string, a location, and optional location arguments.
In camlp5, the function accepts only a string and the location information
is passed in indirectly. I find this direct handling of locations easier
to manipulate. Second, camlp4 allows me to register a quotation for a
specific kind of ocaml ast (expression, pattern, whatever.) In camlp5,
every time I register a quotation, I must supply code for both expressions
and patterns. Third, although initially extremely confusing, I now prefer
the functor organization that camlp4 uses. The functors make it clear as
to how the syntax is extended. For example, the the original OCaml syntax
is represented as an extension of the revised syntax. In order to create
the appropriate original syntax module in camlp4, we use the code:
module CamlSyntax=Camlp4OCamlParser.Make(
Camlp4OCamlRevisedParser.Make(
Camlp4.PreCast.Syntax));;
Here, we can see that PreCast adds the necessary starting material, the
revised parser adds the revised syntax, and the original syntax is an
extension of the revised. Because of this organization, I find the
relationship of syntax extensions more clear in camlp4. In order to make
this organization more understandable, make sure you use ocamlbrowser and
not the module M=Stuff trick on the top level. The nesting of modules in
camlp4 is huge.
In any case, both work extremely well and much of what you should
use comes down to preference.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Caml-list] camlp4
2010-02-06 12:14 ` Tiphaine Turpin
2010-02-06 12:44 ` Guillaume Yziquel
@ 2010-02-07 17:19 ` Martin DeMello
2010-02-08 1:14 ` Ashish Agarwal
1 sibling, 1 reply; 15+ messages in thread
From: Martin DeMello @ 2010-02-07 17:19 UTC (permalink / raw)
To: Tiphaine Turpin; +Cc: caml-list
On Sat, Feb 6, 2010 at 5:44 PM, Tiphaine Turpin
<Tiphaine.Turpin@irisa.fr> wrote:
> - the source folder tree is deep, and thus harder to grep
tangentially, i've found that a great way to deal with that is to
import the whole thing into a local git repository and then use git
grep. works like a charm, and is *fast*.
martin
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Caml-list] camlp4
2010-02-07 17:19 ` Martin DeMello
@ 2010-02-08 1:14 ` Ashish Agarwal
2010-02-08 2:01 ` Yoann Padioleau
2010-02-08 2:03 ` Erik de Castro Lopo
0 siblings, 2 replies; 15+ messages in thread
From: Ashish Agarwal @ 2010-02-08 1:14 UTC (permalink / raw)
To: Martin DeMello; +Cc: Tiphaine Turpin, caml-list
[-- Attachment #1: Type: text/plain, Size: 845 bytes --]
> - the source folder tree is deep, and thus harder to grep
I use find.
$ find ./ -exec grep "foo" {} \;
On Sun, Feb 7, 2010 at 12:19 PM, Martin DeMello <martindemello@gmail.com>wrote:
> On Sat, Feb 6, 2010 at 5:44 PM, Tiphaine Turpin
> <Tiphaine.Turpin@irisa.fr> wrote:
> > - the source folder tree is deep, and thus harder to grep
>
> tangentially, i've found that a great way to deal with that is to
> import the whole thing into a local git repository and then use git
> grep. works like a charm, and is *fast*.
>
> martin
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
[-- Attachment #2: Type: text/html, Size: 1682 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Caml-list] camlp4
2010-02-08 1:14 ` Ashish Agarwal
@ 2010-02-08 2:01 ` Yoann Padioleau
2010-02-08 2:03 ` Erik de Castro Lopo
1 sibling, 0 replies; 15+ messages in thread
From: Yoann Padioleau @ 2010-02-08 2:01 UTC (permalink / raw)
To: Ashish Agarwal; +Cc: Martin DeMello, Tiphaine Turpin, caml-list
[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]
On Feb 7, 2010, at 5:14 PM, Ashish Agarwal wrote:
> > - the source folder tree is deep, and thus harder to grep
>
> I use find.
>
> $ find ./ -exec grep "foo" {} \;
You can also use a shell like zsh or eshell and do
grep foo **/*.ml*
When you use eshell the grep result is even clickable.
>
>
>
> On Sun, Feb 7, 2010 at 12:19 PM, Martin DeMello <martindemello@gmail.com> wrote:
> On Sat, Feb 6, 2010 at 5:44 PM, Tiphaine Turpin
> <Tiphaine.Turpin@irisa.fr> wrote:
> > - the source folder tree is deep, and thus harder to grep
>
> tangentially, i've found that a great way to deal with that is to
> import the whole thing into a local git repository and then use git
> grep. works like a charm, and is *fast*.
>
> martin
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
[-- Attachment #2: Type: text/html, Size: 2765 bytes --]
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Caml-list] camlp4
2010-02-08 1:14 ` Ashish Agarwal
2010-02-08 2:01 ` Yoann Padioleau
@ 2010-02-08 2:03 ` Erik de Castro Lopo
1 sibling, 0 replies; 15+ messages in thread
From: Erik de Castro Lopo @ 2010-02-08 2:03 UTC (permalink / raw)
To: caml-list
Ashish Agarwal wrote:
> > - the source folder tree is deep, and thus harder to grep
>
> I use find.
>
> $ find ./ -exec grep "foo" {} \;
If you're using GNU grep:
grep -r foo .
Erik
--
----------------------------------------------------------------------
Erik de Castro Lopo
http://www.mega-nerd.com/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Caml-list] camlp4
2010-02-06 12:44 ` Guillaume Yziquel
@ 2010-02-09 15:30 ` Guillaume Yziquel
2010-02-09 18:29 ` Jake Donham
0 siblings, 1 reply; 15+ messages in thread
From: Guillaume Yziquel @ 2010-02-09 15:30 UTC (permalink / raw)
Cc: Tiphaine Turpin, caml-list
Guillaume Yziquel a écrit :
> Tiphaine Turpin a écrit :
>> Andy Ray a écrit :
>>> What should one do?
>>>
>> Complaining on the list about lack of camlp4 documentation is a good
>> start :-). To help you decide (and increase the pressure on the Ocaml
>> team), I would like to mention some of the difficulties that I
>> encountered when trying to understand camlp4 as a user:
>
> -2- A good hands-on introduction, to be read in conjunction with
> up-to-date camlp4 code:
>
> http://martin.jambon.free.fr/extend-ocaml-syntax.html
http://ambassadortothecomputers.blogspot.com/search/label/camlp4
is also a good link, covering the essentials to get started with camlp4,
I think.
--
Guillaume Yziquel
http://yziquel.homelinux.org/
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [Caml-list] camlp4
2010-02-09 15:30 ` Guillaume Yziquel
@ 2010-02-09 18:29 ` Jake Donham
0 siblings, 0 replies; 15+ messages in thread
From: Jake Donham @ 2010-02-09 18:29 UTC (permalink / raw)
To: guillaume.yziquel; +Cc: Tiphaine Turpin, caml-list
On Tue, Feb 9, 2010 at 7:30 AM, Guillaume Yziquel
<guillaume.yziquel@citycable.ch> wrote:
> http://ambassadortothecomputers.blogspot.com/search/label/camlp4
>
> is also a good link, covering the essentials to get started with camlp4, I
> think.
Thanks for the plug; the series is sadly incomplete but I hope to get
back to it very soon.
Jake
^ permalink raw reply [flat|nested] 15+ messages in thread
* camlp4
@ 2008-01-18 17:08 Christian Sternagel
0 siblings, 0 replies; 15+ messages in thread
From: Christian Sternagel @ 2008-01-18 17:08 UTC (permalink / raw)
To: caml-list
When using `camlp4o -parser Camlp4ListComprehension' as preprocessor,
is the resulting code the naive translation, like in,
[(x, y) | x <- xs, even xs, y <- ys]
=>
List.flatten (
List.map (fun x -> List.map (fun y -> (x, y)) ys) (List.filter even xs)
)
or is there an optimization in order to avoid appends and minimize the
number of cons?
cheers
christian
^ permalink raw reply [flat|nested] 15+ messages in thread
* camlp4
@ 1997-01-14 12:47 Daniel de Rauglaudre
0 siblings, 0 replies; 15+ messages in thread
From: Daniel de Rauglaudre @ 1997-01-14 12:47 UTC (permalink / raw)
To: caml-list
We present the first distributed version of Camlp4 (0.4).
Camlp4 is a PreProcessorPrettyPrinter for Objective Caml. It offers
new syntactic library tools and the ability to change, extend and
redefine the concrete syntax of Objective Caml.
In the continuation of the work on "Chamau", but Camlp4 is compatible
with Objective Caml (the knowledge of Chamau is not necessary to use
Camlp4).
Available by anonymous ftp at INRIA
ftp.inria.fr (192.93.2.54)
Directory lang/chamau.
Or by the Web:
ftp://ftp.inria.fr/lang/chamau/
Files: README.camlp4, camlp4.tar.gz, camlp4-doc.ps.gz
--------------------------------------------------------------------------
Daniel de RAUGLAUDRE
Projet Cristal - INRIA Rocquencourt
Tel: +33 (01) 39 63 53 51
Email: daniel.de_rauglaudre@inria.fr
Web: http://pauillac.inria.fr:80/~ddr/
--------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2010-02-09 18:29 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-06 1:16 camlp4 Andy Ray
2010-02-06 11:15 ` [Caml-list] camlp4 blue storm
2010-02-06 12:14 ` Tiphaine Turpin
2010-02-06 12:44 ` Guillaume Yziquel
2010-02-09 15:30 ` Guillaume Yziquel
2010-02-09 18:29 ` Jake Donham
2010-02-07 17:19 ` Martin DeMello
2010-02-08 1:14 ` Ashish Agarwal
2010-02-08 2:01 ` Yoann Padioleau
2010-02-08 2:03 ` Erik de Castro Lopo
2010-02-06 13:37 ` Ed Keith
2010-02-06 16:25 ` camlp4 Chris Conway
2010-02-07 13:51 ` [Caml-list] camlp4 Joseph Young
-- strict thread matches above, loose matches on Subject: below --
2008-01-18 17:08 camlp4 Christian Sternagel
1997-01-14 12:47 camlp4 Daniel de Rauglaudre
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox