From: Zorg 421 <zorglub421@gmail.com>
To: caml-list@yquem.inria.fr
Subject: printing the AST of a caml function
Date: Sun, 22 Mar 2009 17:24:12 +0100 [thread overview]
Message-ID: <6b546c750903220924p1d845975qc4436f46ec1d1361@mail.gmail.com> (raw)
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.
next reply other threads:[~2009-03-22 16:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-22 16:24 Zorg 421 [this message]
2009-03-22 17:41 ` [Caml-list] " blue storm
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=6b546c750903220924p1d845975qc4436f46ec1d1361@mail.gmail.com \
--to=zorglub421@gmail.com \
--cc=caml-list@yquem.inria.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