From: Aleksey Nogin <nogin@metaprl.org>
To: Caml List <caml-list@inria.fr>
Cc: Nicolas Pouillard <nicolas.pouillard@gmail.com>
Subject: 3.10.0+beta: pa_macro vs Camlp4MacroParser [Was: "Not_found" from a custom camlp4 executable]
Date: Mon, 16 Apr 2007 15:49:03 -0700 [thread overview]
Message-ID: <4623FD5F.30006@metaprl.org> (raw)
In-Reply-To: <cd67f63a0704161326k725af720p2168d9f09142baf6@mail.gmail.com>
On 16.04.2007 13:26, Nicolas Pouillard wrote:
>> % ocamlc -g -thread -I -custom -o macroprint unix.cma threads.cma
>> camlp4/camlp4lib.cma camlp4/Camlp4Printers/Camlp4OCamlPrinter.cmo
>> camlp4/Camlp4Parsers/Camlp4OCamlParser.cmo Camlp4MacroParser.cmo
>> camlp4/Camlp4Filters/Camlp4TrashRemover.cmo camlp4/Camlp4Bin.cmo -linkall
>
> You should add the revised grammar before the original one since the
> original is a syntax extension of the revised.
Thanks a lot for your lightning-fast response! Yes, this is what I was
missing - and once I've added the revisied syntax parser to the list of
odules to compile, things started working (sort of).
Now that I can build it, I see that the "refactoring" of pa_macro into
Camlp4MacroParser is, unfortunately, very broken in one important
respect. In the pa_macro, the macro definitions inside an IFDEF were
only collected while the body of IFDEF is parsed and were not executed
until after the IFDEF is parsed and the condition is evaluated. In the
"refactored" Camlp4MacroParser all the "DEFINE" directives are executed
right away!
So, what this means is that
DEFINE TRUE;;
IFDEF TRUE THEN
DEFINE XYZ = 1
ELSE
DEFINE XYZ = 2
ENDIF;;
let xyz = XYZ;;
would correctly result in "let xyz = 1" in pa_macro, but with
Camlp4MacroParser, I get "let xyz = 2"!
Also note that the item_or_def type that was responsible for collecting
the "delayed" definitions in the pa_macro is no longer used in
Camlp4MacroParser.
Aleksey
next prev parent reply other threads:[~2007-04-16 22:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-16 20:20 3.10.0+beta - "Not_found" from a custom camlp4 executable (Delete.delete_rule_in_suffix) Aleksey Nogin
2007-04-16 20:26 ` [Caml-list] " Nicolas Pouillard
2007-04-16 22:49 ` Aleksey Nogin [this message]
2007-04-17 1:12 ` 3.10.0+beta: Corrected and improved Camlp4MacroParser Aleksey Nogin
2007-04-17 19:28 ` Nicolas Pouillard
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=4623FD5F.30006@metaprl.org \
--to=nogin@metaprl.org \
--cc=caml-list@inria.fr \
--cc=nicolas.pouillard@gmail.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