Re : Re : [Caml-list] camlp4 stream parser syntax

2009-03-07 Thread Matthieu Wipliez
> While we are on this subject... How do you troubleshoot camlp4 rules? Not sure what you mean :( > With a stream parser you can invoke individual functions since each is a > full-blown parser. Can the same be done with camlp4, e.g. individual rules > invoked? Well when you invoke the parser

Re: Re : [Caml-list] camlp4 stream parser syntax

2009-03-07 Thread Joel Reymont
On Mar 8, 2009, at 12:20 AM, Matthieu Wipliez wrote: Joel asked me the parser so I gave it to him, but maybe it can be of use for others, so here it is. While we are on this subject... How do you troubleshoot camlp4 rules? With a stream parser you can invoke individual functions since each

Re: [Caml-list] camlp4 stream parser syntax

2009-03-07 Thread Jon Harrop
On Sunday 08 March 2009 00:20:06 Matthieu Wipliez wrote: > Joel asked me the parser so I gave it to him, but maybe it can be of use > for others, so here it is. Apart from the code specific to the application, > it gives a good example of a complete Camlp4 lexer/parser for a language. > > Note that

Re : [Caml-list] camlp4 stream parser syntax

2009-03-07 Thread Matthieu Wipliez
Joel asked me the parser so I gave it to him, but maybe it can be of use for others, so here it is. Apart from the code specific to the application, it gives a good example of a complete Camlp4 lexer/parser for a language. Note that for the lexer I started from a custom lexer made by Pietro Abat

Re: [Caml-list] camlp4 stream parser syntax

2009-03-07 Thread Jon Harrop
On Saturday 07 March 2009 23:53:03 you wrote: > Should I be using camlp4 grammars as Matthieu suggested? > > It seems there are are far more and better resources on doing this > than the stream parsing approach. This includes your OCaml Journal. I would say that there is very little documentation

Re: [Caml-list] camlp4 stream parser syntax

2009-03-07 Thread Joel Reymont
Jon, On Mar 7, 2009, at 11:52 PM, Jon Harrop wrote: The [< .. >] denote a stream when matching over one using the "parser" keyword and the tick ' denotes a kind of literal to identify a single token in the stream. So: | [< 'Kwd "if"; p=parse_expr; 'Kwd "then"; t=parse_expr; 'Kwd

Re: [Caml-list] camlp4 stream parser syntax

2009-03-07 Thread Jon Harrop
On Saturday 07 March 2009 22:38:14 Joel Reymont wrote: > Where can I read up on the syntax of the following in a camlp4 stream > parser? > >| [<' INT n >] -> Int n > > For example, where are [< ... >] described and why is the ' needed in > between? The grammar is described formally here: ht