caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* using a camlp4 man filter with my own type
@ 2009-03-05 15:04 Joel Reymont
  2009-03-05 15:15 ` [Caml-list] " Nicolas Pouillard
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Reymont @ 2009-03-05 15:04 UTC (permalink / raw)
  To: O'Caml Mailing List

I looked at the Camlp4 filter wiki [1] but still can't figure this out.

+ ocamlfind ocamlc -package 'oUnit, dyp, extlib' -c -I +camlp4 -g -w a  
-pp 'camlp4of -I src -filter map' -I src -o src/easy_type_check.cmo  
src/easy_type_check.ml
File "src/easy_type_check.ml", line 45, characters 10-15:
Error: This expression has no method expr

This used to work fine in 3.10.x and the error points to "match  
super#expr e with" in strip_token_loc below.

	Thanks, Joel

---

Here's the code...

open Easy_ast
open Easy_symtab

exception TypeCheck_error of string

let type_check_error s = raise (TypeCheck_error s)

(* Type inference *)

let rec infer_type env = function
   | Int _                    -> TyInt
   ... etc

(* Remove annotations for unit testing *)

class map = Camlp4MapGenerator.generated;;

let strip_token_loc = object
   inherit map as super
   method expr e =
     match super#expr e with
       | TokenPos (a, _) -> a
       | e                -> e
end

let strip_stmt x = strip_token_loc#statement x;;

module Camlp4Trash = struct
   INCLUDE "easy_ast.ml";;
end;;

[1] http://brion.inria.fr/gallium/index.php/Camlp4MapGenerator

---
http://tinyco.de
Mac, C++, OCaml




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

* Re: [Caml-list] using a camlp4 man filter with my own type
  2009-03-05 15:04 using a camlp4 man filter with my own type Joel Reymont
@ 2009-03-05 15:15 ` Nicolas Pouillard
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Pouillard @ 2009-03-05 15:15 UTC (permalink / raw)
  To: Joel Reymont; +Cc: O'Caml Mailing List

Excerpts from Joel Reymont's message of Thu Mar 05 16:04:09 +0100 2009:
> I looked at the Camlp4 filter wiki [1] but still can't figure this out.
> 
> + ocamlfind ocamlc -package 'oUnit, dyp, extlib' -c -I +camlp4 -g -w a  
> -pp 'camlp4of -I src -filter map' -I src -o src/easy_type_check.cmo  
> src/easy_type_check.ml
> File "src/easy_type_check.ml", line 45, characters 10-15:
> Error: This expression has no method expr
> 
> This used to work fine in 3.10.x and the error points to "match  
> super#expr e with" in strip_token_loc below.

Can you look at (or post) the result of the generation?

$ camlp4of -I src -filter map src/easy_type_check.ml


-- 
Nicolas Pouillard


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-05 15:04 using a camlp4 man filter with my own type Joel Reymont
2009-03-05 15:15 ` [Caml-list] " Nicolas Pouillard

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