caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Camlp4 lexers (>= 3.10)
@ 2008-05-02 20:15 O'Leary, John W
  2008-05-02 22:07 ` [Caml-list] " Alain Frisch
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: O'Leary, John W @ 2008-05-02 20:15 UTC (permalink / raw)
  To: caml-list

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]

Does anyone have an example that would show me how to connect my own
lexer to a Camlp4 parser?

 

I've scoured the wiki (http://brion.inria.fr/gallium/index.php/Camlp4)
but all the examples there use the ocaml lexer.

 

Thanks,

--John O'Leary


[-- Attachment #2: Type: text/html, Size: 2044 bytes --]

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

* Re: [Caml-list] Camlp4 lexers (>= 3.10)
  2008-05-02 20:15 Camlp4 lexers (>= 3.10) O'Leary, John W
@ 2008-05-02 22:07 ` Alain Frisch
  2008-05-02 22:14 ` Gordon Henriksen
  2008-05-03  5:12 ` Gabriel Kerneis
  2 siblings, 0 replies; 4+ messages in thread
From: Alain Frisch @ 2008-05-02 22:07 UTC (permalink / raw)
  To: O'Leary, John W; +Cc: caml-list

O'Leary, John W wrote:
> Does anyone have an example that would show me how to connect my own
> lexer to a Camlp4 parser?
>
> I’ve scoured the wiki (http://brion.inria.fr/gallium/index.php/Camlp4)
> but all the examples there use the ocaml lexer.

CDuce's parser uses a lexer generated by ulex:

http://www.cduce.org/cgi-bin/viewcvs.cgi/cduce/trunk/parser/

(Parser and Ulexer modules)


-- Alain


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

* Re: [Caml-list] Camlp4 lexers (>= 3.10)
  2008-05-02 20:15 Camlp4 lexers (>= 3.10) 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
  2 siblings, 0 replies; 4+ messages in thread
From: Gordon Henriksen @ 2008-05-02 22:14 UTC (permalink / raw)
  To: caml-list

On May 2, 2008, at 16:15, O'Leary, John W wrote:

> Does anyone have an example that would show me how to connect my own  
> lexer to a Camlp4 parser?
>
> I’ve scoured the wiki (http://brion.inria.fr/gallium/index.php/ 
> Camlp4) but all the examples there use the ocaml lexer.


There's one here:

http://llvm.org/docs/tutorial/OCamlLangImpl1.html

— Gordon


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

* Re: [Caml-list] Camlp4 lexers (>= 3.10)
  2008-05-02 20:15 Camlp4 lexers (>= 3.10) 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
  2 siblings, 0 replies; 4+ messages in thread
From: Gabriel Kerneis @ 2008-05-03  5:12 UTC (permalink / raw)
  To: O'Leary, John W; +Cc: caml-list

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


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

end of thread, other threads:[~2008-05-03  5:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-02 20:15 Camlp4 lexers (>= 3.10) 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 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).