Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Gabriel Kerneis <kerneis@enst.fr>
To: "O'Leary, John W" <john.w.oleary@intel.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Camlp4 lexers (>= 3.10)
Date: Sat, 3 May 2008 07:12:08 +0200	[thread overview]
Message-ID: <20080503051208.GA4231@kerneis.info> (raw)
In-Reply-To: <C1B6100C383B23438DEC6B1A3D915EAC03B2DD06@orsmsx411.amr.corp.intel.com>

On Fri, May 02, 2008 at 01:15:36PM -0700, O'Leary, John W wrote:
> Does anyone have an example that would show me how to connect my own
> lexer to a Camlp4 parser?

You can have a look at Ocsigen's xmlp4 module (allowing you to type
xhtml code in quotations and get an AST):

http://ocsigen.org/darcsweb/?r=ocsigen.current;a=tree;f=/xmlp4/newocaml

Especially the files xmllexer.mll (using ocamlex, based on lexer.mll
from ocaml source) and xhtmlparser.ml (written in revised syntax). 

The interresting parts are at the end of both files (look at functions
Xmllexer.from_string = Xhtmlparser.parse, Xhtmlparser.xml_exp).

Regards,
-- 
Gabriel Kerneis


      parent reply	other threads:[~2008-05-03  5:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-02 20:15 O'Leary, John W
2008-05-02 22:07 ` [Caml-list] " Alain Frisch
2008-05-02 22:14 ` Gordon Henriksen
2008-05-03  5:12 ` Gabriel Kerneis [this message]

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=20080503051208.GA4231@kerneis.info \
    --to=kerneis@enst.fr \
    --cc=caml-list@yquem.inria.fr \
    --cc=john.w.oleary@intel.com \
    /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