caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* parser syntax?
@ 2005-10-31  6:01 Jonathan Roewen
  2005-10-31  6:08 ` [Caml-list] " Jon Harrop
  0 siblings, 1 reply; 7+ messages in thread
From: Jonathan Roewen @ 2005-10-31  6:01 UTC (permalink / raw)
  To: caml-list

Hi,

How do I use the parser syntax in OCaml? I was looking at genlex, and
the given code doesn't compile. Doesn't seem to like the parser
keyword or something.

Jonathan


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] parser syntax?
  2005-10-31  6:01 parser syntax? Jonathan Roewen
@ 2005-10-31  6:08 ` Jon Harrop
  2005-10-31  6:24   ` Jonathan Roewen
  0 siblings, 1 reply; 7+ messages in thread
From: Jon Harrop @ 2005-10-31  6:08 UTC (permalink / raw)
  To: caml-list

On Monday 31 October 2005 06:01, Jonathan Roewen wrote:
> How do I use the parser syntax in OCaml? I was looking at genlex, and
> the given code doesn't compile. Doesn't seem to like the parser
> keyword or something.

Just a guess but should it be piped through camlp4 to get the stream and 
parser syntax?

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] parser syntax?
  2005-10-31  6:08 ` [Caml-list] " Jon Harrop
@ 2005-10-31  6:24   ` Jonathan Roewen
  2005-10-31 12:37     ` Oliver Bandel
  2005-10-31 22:47     ` Jonathan Roewen
  0 siblings, 2 replies; 7+ messages in thread
From: Jonathan Roewen @ 2005-10-31  6:24 UTC (permalink / raw)
  To: Jon Harrop; +Cc: caml-list

> Just a guess but should it be piped through camlp4 to get the stream and
> parser syntax?

Ohh, is this a change from ocaml 2.x? Is there a script somewhere that
can almost automatically convert ocaml 2.x syntax to 3.x?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] parser syntax?
  2005-10-31  6:24   ` Jonathan Roewen
@ 2005-10-31 12:37     ` Oliver Bandel
  2005-10-31 16:40       ` David Brown
  2005-10-31 22:47     ` Jonathan Roewen
  1 sibling, 1 reply; 7+ messages in thread
From: Oliver Bandel @ 2005-10-31 12:37 UTC (permalink / raw)
  To: caml-list

On Mon, Oct 31, 2005 at 07:24:29PM +1300, Jonathan Roewen wrote:
> > Just a guess but should it be piped through camlp4 to get the stream and
> > parser syntax?
> 
> Ohh, is this a change from ocaml 2.x? Is there a script somewhere that
> can almost automatically convert ocaml 2.x syntax to 3.x?
[...]

IMHO camlp4 and the compilers could be used in ONE
command. I don't know if camlp4 could invoke the compilers
or the compilers could invoke camlp4 (I think the latter was the case),
but IMHO something like that was possible (at least in older releases).

But I always found this behaviour very strange and
if camlp4 only works as a filter/preprocessor I think this is much more
clear. (Maybe a problem in documentation of these features that I
found it strange.)

Ciao,
   Oliver


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] parser syntax?
  2005-10-31 12:37     ` Oliver Bandel
@ 2005-10-31 16:40       ` David Brown
  0 siblings, 0 replies; 7+ messages in thread
From: David Brown @ 2005-10-31 16:40 UTC (permalink / raw)
  To: Oliver Bandel; +Cc: caml-list

On Mon, 2005-10-31 at 13:37 +0100, Oliver Bandel wrote:

> IMHO camlp4 and the compilers could be used in ONE
> command. I don't know if camlp4 could invoke the compilers
> or the compilers could invoke camlp4 (I think the latter was the case),
> but IMHO something like that was possible (at least in older releases).

Isn't that the purpose of 'ocamlc -pp ...'?

Dave


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] parser syntax?
  2005-10-31  6:24   ` Jonathan Roewen
  2005-10-31 12:37     ` Oliver Bandel
@ 2005-10-31 22:47     ` Jonathan Roewen
  2005-11-01 22:23       ` Matt Gushee
  1 sibling, 1 reply; 7+ messages in thread
From: Jonathan Roewen @ 2005-10-31 22:47 UTC (permalink / raw)
  To: Jon Harrop; +Cc: caml-list

So what's the command line I need to compile source with 'parser' syntax?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Caml-list] parser syntax?
  2005-10-31 22:47     ` Jonathan Roewen
@ 2005-11-01 22:23       ` Matt Gushee
  0 siblings, 0 replies; 7+ messages in thread
From: Matt Gushee @ 2005-11-01 22:23 UTC (permalink / raw)
  To: caml-list

Jonathan Roewen wrote:

>> So what's the command line I need to compile source with 'parser' syntax?


I think

  ocamlc -pp camlp4o -c mysource.ml

should be sufficient. In some cases you might need to load additional
Camlp4 modules, in which case you'd do something like:

  ocamlc -pp 'camlp4o foo.cmo' -c mysource.ml

E.g., a commonly-used set for when you write your own syntax extensions is:

  ocamlc -pp 'camlp4o pa_extend.cmo q_MLast.cmo' -c mysource.ml

[ Pa_extend parses the grammar extension syntax, and Q_MLast processes
  quotation expanders to generate an AST. ]

But that's not what you're doing, so try the simplest version first.

--
Matt Gushee
Englewood, CO, USA




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-11-01 22:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-31  6:01 parser syntax? Jonathan Roewen
2005-10-31  6:08 ` [Caml-list] " Jon Harrop
2005-10-31  6:24   ` Jonathan Roewen
2005-10-31 12:37     ` Oliver Bandel
2005-10-31 16:40       ` David Brown
2005-10-31 22:47     ` Jonathan Roewen
2005-11-01 22:23       ` Matt Gushee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).