Commit 875d0216 authored by POTTIER Francois's avatar POTTIER Francois

Split expr12.

parent 2feb23a1
......@@ -2,19 +2,3 @@ type 'expr oexpr =
| EConst of int
| EAdd of 'expr * 'expr
[@@deriving visitors { name = "omap"; variety = "map" }]
type expr =
E of expr oexpr [@@unboxed]
class ['self] map = object (self : 'self)
inherit [_] omap
method visit_'expr env (E e) =
E (self#visit_oexpr env e)
end
let double (e : expr) : expr =
let v = object
inherit [_] map
method! visit_EConst _env k = EConst (2 * k)
end in
v # visit_'expr () e
open Expr12
type expr =
E of expr oexpr [@@unboxed]
class ['self] map = object (self : 'self)
inherit [_] omap
method visit_'expr env (E e) =
E (self#visit_oexpr env e)
end
let double (e : expr) : expr =
let v = object
inherit [_] map
method! visit_EConst _env k = EConst (2 * k)
end in
v # visit_'expr () e
open Expr12
open Expr13
let const k = E (EConst k)
let add e1 e2 = E (EAdd (e1, e2))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment