Browse thread
How to Create Sensible Debugging Information when Dynamically Typechecking Code Generated with camlp5 Quotations
[
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: | -- (:) |
| From: | Nicolas Pouillard <nicolas.pouillard@g...> |
| Subject: | Re: [Caml-list] How to Create Sensible Debugging Information when Dynamically Typechecking Code Generated with camlp5 Quotations |
Note: Camlp4 give you locations relative to the entire program ;) Regards, Excerpts from echinuz echinuz's message of Fri Dec 14 22:22:23 +0100 2007: > I have a DSL that I embedded using quotations with camlp5. Essentially, there > are a number of features that are useful in ocaml, such as file io, that I > don't want to add to the language. Using quotations allows me to add these > features. The language, by itself, can be statically type checked, but since I > allow antiquotations I must type check at runtime. Unfortunately, I'm having > trouble figuring out a sensible way to add debugging information during type > checking. A typical program looks like this: > > let x=... in > let prog= <:prog< > embedded commands... > more embedded commands... > >> in > execute prog;; > > The problem with location information generated in camlp5 is that it gives the > location relative to the quote. I'm more interested in location information > relative to the entire program. One thought is to run the file through camlp5 > twice and generate location information using trick similar to __LOCATION__ > from pa_macro. However, since the first pass through expands the quotations, > the subsequent location information tends to be deceptive. > > Is there a good way to generate this location information? Or, more generally, > is there a better way to type check the resulting program? > -- Nicolas Pouillard aka Ertai