[
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: | Joel Reymont <joelr1@g...> |
| Subject: | using a camlp4 man filter with my own type |
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