caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] nosy p4 question
@ 2002-01-23 20:00 Ian Zimmerman
  2002-01-23 20:21 ` Daniel de Rauglaudre
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Zimmerman @ 2002-01-23 20:00 UTC (permalink / raw)
  To: OCAML


Just how does camlp4 manage to change the toplevel input sytax?  The
toplevel has no -pp option ..

Does it redefine the toplevel's internal parser?

-- 
Ian Zimmerman, Oakland, California, U.S.A.
GPG: 433BA087  9C0F 194F 203A 63F7 B1B8  6E5A 8CA3 27DB 433B A087
In his own soul a man bears the source
from which he draws all his sorrows and his joys.
Sophocles.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] nosy p4 question
  2002-01-23 20:00 [Caml-list] nosy p4 question Ian Zimmerman
@ 2002-01-23 20:21 ` Daniel de Rauglaudre
  2002-01-23 20:36   ` Ian Zimmerman
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel de Rauglaudre @ 2002-01-23 20:21 UTC (permalink / raw)
  To: OCAML

Hi,

On Wed, Jan 23, 2002 at 12:00:44PM -0800, Ian Zimmerman wrote:

> Just how does camlp4 manage to change the toplevel input sytax?  The
> toplevel has no -pp option ..

To get the normal OCaml syntax + streams & parsers, type:
   #load "camlp4o.cma";;

To get the revised syntax, type:
   #load "camlp4r.cma";;

You can afterwards change syntax or add syntax extensions by loading the
corresponding cmo or cma file.

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] nosy p4 question
  2002-01-23 20:21 ` Daniel de Rauglaudre
@ 2002-01-23 20:36   ` Ian Zimmerman
  2002-01-23 21:29     ` Daniel de Rauglaudre
  0 siblings, 1 reply; 5+ messages in thread
From: Ian Zimmerman @ 2002-01-23 20:36 UTC (permalink / raw)
  To: OCAML


itz> Just how does camlp4 manage to change the toplevel input sytax?
itz> The toplevel has no -pp option ..

Daniel> To get the normal OCaml syntax + streams & parsers, type:
Daniel> #load "camlp4o.cma";;

Daniel> To get the revised syntax, type: #load "camlp4r.cma";;

Daniel> You can afterwards change syntax or add syntax extensions by
Daniel> loading the corresponding cmo or cma file.

Yes, thanks, but I already know that :-)

My question was, _how_ you do it - that's why I labelled it "nosy"

Best regards,

-- 
Ian Zimmerman, Oakland, California, U.S.A.
GPG: 433BA087  9C0F 194F 203A 63F7 B1B8  6E5A 8CA3 27DB 433B A087
In his own soul a man bears the source
from which he draws all his sorrows and his joys.
Sophocles.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] nosy p4 question
  2002-01-23 20:36   ` Ian Zimmerman
@ 2002-01-23 21:29     ` Daniel de Rauglaudre
  2002-01-23 22:09       ` Ian Zimmerman
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel de Rauglaudre @ 2002-01-23 21:29 UTC (permalink / raw)
  To: OCAML

Hi,

On Wed, Jan 23, 2002 at 12:36:23PM -0800, Ian Zimmerman wrote:

> My question was, _how_ you do it - that's why I labelled it "nosy"

The function which parses the input is a hook (a reference) which
can be modified: it is Toploop.parse_toplevel_phrase. I just lay
my eggs there.

Same for pretty printing. The main hook is Toploop.print_out_value.

-- 
Daniel de RAUGLAUDRE
daniel.de_rauglaudre@inria.fr
http://cristal.inria.fr/~ddr/
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

* Re: [Caml-list] nosy p4 question
  2002-01-23 21:29     ` Daniel de Rauglaudre
@ 2002-01-23 22:09       ` Ian Zimmerman
  0 siblings, 0 replies; 5+ messages in thread
From: Ian Zimmerman @ 2002-01-23 22:09 UTC (permalink / raw)
  To: OCAML


itz> My question was, _how_ you do it - that's why I labelled it "nosy"

Daniel> The function which parses the input is a hook (a reference) which
Daniel> can be modified: it is Toploop.parse_toplevel_phrase. I just lay
Daniel> my eggs there.

Great, thanks!  That's what I wanted to know.

-- 
Ian Zimmerman, Oakland, California, U.S.A.
GPG: 433BA087  9C0F 194F 203A 63F7 B1B8  6E5A 8CA3 27DB 433B A087
In his own soul a man bears the source
from which he draws all his sorrows and his joys.
Sophocles.
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-23 20:00 [Caml-list] nosy p4 question Ian Zimmerman
2002-01-23 20:21 ` Daniel de Rauglaudre
2002-01-23 20:36   ` Ian Zimmerman
2002-01-23 21:29     ` Daniel de Rauglaudre
2002-01-23 22:09       ` Ian Zimmerman

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).