caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Joel Reymont <joelr1@gmail.com>
To: O'Caml Mailing List <caml-list@yquem.inria.fr>
Subject: using a camlp4 man filter with my own type
Date: Thu, 5 Mar 2009 15:04:09 +0000	[thread overview]
Message-ID: <333C38AD-C737-443A-B19A-9DF97E0DBF20@gmail.com> (raw)

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




             reply	other threads:[~2009-03-05 15:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-05 15:04 Joel Reymont [this message]
2009-03-05 15:15 ` [Caml-list] " 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=333C38AD-C737-443A-B19A-9DF97E0DBF20@gmail.com \
    --to=joelr1@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).