Browse thread
3.10.0+beta - "Not_found" from a custom camlp4 executable (Delete.delete_rule_in_suffix)
-
Aleksey Nogin
-
Nicolas Pouillard
- Aleksey Nogin
-
Nicolas Pouillard
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-04-16 (22:49) |
From: | Aleksey Nogin <nogin@m...> |
Subject: | 3.10.0+beta: pa_macro vs Camlp4MacroParser [Was: "Not_found" from a custom camlp4 executable] |
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