caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* printing the AST of a caml function
@ 2009-03-22 16:24 Zorg 421
  2009-03-22 17:41 ` [Caml-list] " blue storm
  0 siblings, 1 reply; 2+ messages in thread
From: Zorg 421 @ 2009-03-22 16:24 UTC (permalink / raw)
  To: caml-list

Hello,

I want to play/understand the caml AST, so I try using this code snippet:

---
let factstring = "let rec fact n = if n < 1 then 0 else n * fact (n-1)" in
let tree = Parse.implementation (Lexing.from_string factstring) in
Printast.implementation (Format.formatter_of_out_channel stdout) tree
---

and this build script (~15 minutes spent in ordering correctly the .cmx :-/ )

---
#!/bin/sh
ocamlopt -I /opt/godi/lib/ocaml/compiler-lib/ misc.cmx linenum.cmx
warnings.cmx location.cmx lexer.cmx syntaxerr.cmx config.cmx
clflags.cmx parser.cmx parse.cmx printast.cmx lexing.cmx format.cmx
factast.ml -o factast
---

But the linker is confused by the Lexing module of stdlib:

Files /opt/godi/lib/ocaml/std-lib/lexing.cmx
and /opt/godi/lib/ocaml/std-lib/stdlib.cmxa both define a module named Lexing

How can I prevent the linker to look in /opt/godi/lib/ocaml/std-lib/
or /opt/godi/lib/ocaml/std-lib/stdlib.cmxa ?

regards.


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

end of thread, other threads:[~2009-03-22 17:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-22 16:24 printing the AST of a caml function Zorg 421
2009-03-22 17:41 ` [Caml-list] " blue storm

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