File: expr08.ml

package info (click to toggle)
ocaml-visitors 20180513-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,640 kB
  • sloc: ml: 4,063; makefile: 120; sh: 13
file content (18 lines) | stat: -rw-r--r-- 325 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
open Expr12 (* oexpr *)

open Hashcons

type hexpr =
  H of hexpr oexpr hash_consed [@@unboxed]

let table =
  create 128

let h (e : hexpr oexpr) : hexpr =
  H (hashcons table e)

class ['self] hmap = object (self : 'self)
  inherit [_] omap
  method visit_'expr env (H { node = e; _ }) =
    h (self#visit_oexpr env e)
end