Commit 8d9ca05b authored by POTTIER Francois's avatar POTTIER Francois

Introduced macros in Term.

parent d339979b
TARGET := \ TARGET := \
Main.native Main.native
PWD := \
$(shell pwd)
ALPHALIB := \
`ocamlfind query alphaLib`
OCAMLBUILD := \ OCAMLBUILD := \
ocamlbuild \ ocamlbuild \
-use-ocamlfind \ -use-ocamlfind \
-classic-display \ -classic-display \
-plugin-tag 'package(cppo_ocamlbuild)' \
-tag "cppo_I($(ALPHALIB))" \
-tag "cppo_I($(PWD))" \
MLI := \ MLI := \
$(patsubst %.ml,%.inferred.mli,$(wildcard *.ml)) $(patsubst %.ml,%.inferred.mli,$(wildcard *.ml))
......
open AlphaLib open AlphaLib
open BindingForms open BindingForms
type ('bn, 'fn) tele = #define tele ('bn, 'fn) tele
#define term ('bn, 'fn) term
type tele =
| TeleNil | TeleNil
| TeleCons of 'bn binder * ('bn, 'fn) term outer * ('bn, 'fn) tele rebind | TeleCons of 'bn binder * term outer * tele rebind
and ('bn, 'fn) term = and term =
| TVar of 'fn | TVar of 'fn
| TPi of (('bn, 'fn) tele, ('bn, 'fn) term) bind | TPi of (tele, term) bind
| TLam of (('bn, 'fn) tele, ('bn, 'fn) term) bind | TLam of (tele, term) bind
| TApp of ('bn, 'fn) term * ('bn, 'fn) term list | TApp of term * term list
[@@deriving visitors { variety = "iter"; ancestors = ["BindingForms.iter"]; public = ["visit_term"] }, [@@deriving visitors { variety = "iter"; ancestors = ["BindingForms.iter"]; public = ["visit_term"] },
visitors { variety = "map"; ancestors = ["BindingForms.map"]; public = ["visit_term"] }, visitors { variety = "map"; ancestors = ["BindingForms.map"]; public = ["visit_term"] },
visitors { variety = "endo"; ancestors = ["BindingForms.endo"]; public = ["visit_term"] }, visitors { variety = "endo"; ancestors = ["BindingForms.endo"]; public = ["visit_term"] },
......
let () =
Ocamlbuild_plugin.dispatch (fun phase ->
Ocamlbuild_cppo.dispatcher phase
)
...@@ -11,13 +11,14 @@ type tyvar = ...@@ -11,13 +11,14 @@ type tyvar =
(* Types. *) (* Types. *)
#define TYP ('bn, 'fn) typ #define typ ('bn, 'fn) typ
#define term ('bn, 'fn) term
type TYP = type typ =
| TyVar of 'fn | TyVar of 'fn
| TyArrow of TYP * TYP | TyArrow of typ * typ
| TyProduct of TYP * TYP | TyProduct of typ * typ
| TyForall of ('bn, TYP) abs | TyForall of ('bn, typ) abs
(* Term variables. *) (* Term variables. *)
...@@ -25,17 +26,18 @@ and tevar = (string[@opaque]) ...@@ -25,17 +26,18 @@ and tevar = (string[@opaque])
(* Terms. *) (* Terms. *)
#define TERM ('bn, 'fn) term and term =
and TERM =
| TeVar of tevar | TeVar of tevar
| TeAbs of tevar * TYP * TERM | TeAbs of tevar * typ * term
| TeApp of TERM * TERM | TeApp of term * term
| TeLet of tevar * TERM * TERM | TeLet of tevar * term * term
| TeTyAbs of ('bn, TERM) abs | TeTyAbs of ('bn, term) abs
| TeTyApp of TERM * TYP | TeTyApp of term * typ
| TePair of TERM * TERM | TePair of term * term
| TeProj of int * TERM | TeProj of int * term
#undef typ
#undef term
(* Visitor generation. *) (* Visitor generation. *)
......
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