caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Olivier Andrieu <andrieu@ijm.jussieu.fr>
To: Christophe Raffalli <christophe.raffalli@univ-savoie.fr>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] camlp4 char stream
Date: Mon, 12 Sep 2005 15:27:16 +0200	[thread overview]
Message-ID: <17189.33332.99301.539540@karryall.dnsalias.org> (raw)
In-Reply-To: <43251497.1090905@univ-savoie.fr>

 Christophe Raffalli [Monday 12 September 2005] :
 > 
 > OK, I found it (quote from your tutorial):
 > 
 > let operator_rparen =
 >    Grammar.Entry.of_parser gram "operator_rparen"
 >      (fun strm ->
 >         match Stream.npeek 2 strm with
 > 	 | [("", s); ("", ")")] when is_operator s ->
 > 	     begin
 > 	       Stream.junk strm;
 > 	       Stream.junk strm;
 > 	       s
 > 	     end
 > 	 | _ -> raise Stream.Failure)
 > 
 > OK, I read your tutorial, but did not get the point ... thks
 > 
 > and what is the first member of the tuple ?
 > Why is the second member a string and not a char ?

That's just how the camlp4 lexer works, cf. :
  http://caml.inria.fr/pub/docs/manual-camlp4/manual005.html#toc13
  http://caml.inria.fr/pub/docs/manual-camlp4/lib/Plexer.html

If I understand, you'd want to switch to a different lexer (and
parser) at some point. As Martin said, quotation expanders let you
basically do that. But IIRC camlp4 (the program) only expands
quotations in expression or pattern levels, not at the structure item
level so that won't work for you. But the ocpp program (installed with
camlp4) expands quotation in any file (only quotations returning
string of course).

-- 
   Olivier


  parent reply	other threads:[~2005-09-12 13:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-11 20:19 Christophe Raffalli
2005-09-11 21:51 ` [Caml-list] " Martin Jambon
2005-09-12  5:39   ` Christophe Raffalli
2005-09-12  6:40     ` Martin Jambon
2005-09-12 13:27     ` Olivier Andrieu [this message]
2005-09-12 22:31     ` Pietro Abate

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=17189.33332.99301.539540@karryall.dnsalias.org \
    --to=andrieu@ijm.jussieu.fr \
    --cc=caml-list@inria.fr \
    --cc=christophe.raffalli@univ-savoie.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).