From 81fb055292f49a76732c1966874b8d2ad2cb1807 Mon Sep 17 00:00:00 2001 From: Nathan Ringo Date: Thu, 18 Jan 2024 16:45:03 -0600 Subject: Start of our own AST. --- discocaml/.ocamlformat | 0 discocaml/ast.ml | 3 +++ discocaml/dune | 9 ++++++--- discocaml/eval.ml | 7 +++++++ 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 discocaml/.ocamlformat create mode 100644 discocaml/ast.ml create mode 100644 discocaml/eval.ml (limited to 'discocaml') diff --git a/discocaml/.ocamlformat b/discocaml/.ocamlformat new file mode 100644 index 0000000..e69de29 diff --git a/discocaml/ast.ml b/discocaml/ast.ml new file mode 100644 index 0000000..009ea87 --- /dev/null +++ b/discocaml/ast.ml @@ -0,0 +1,3 @@ +type expr = Foo [@@deriving show { with_path = false }] + +let expr_of_parsetree : Parsetree.expression -> expr = function _ -> Foo diff --git a/discocaml/dune b/discocaml/dune index 961fe70..50b12c2 100644 --- a/discocaml/dune +++ b/discocaml/dune @@ -2,14 +2,17 @@ (name discocaml) (inline_tests) (libraries compiler-libs.common yojson) - (modules discocaml) + (modules ast discocaml eval) (package discocaml) (preprocess (pps ppx_deriving.show ppx_deriving_yojson ppx_expect))) +(env + (release + (link_flags + (:standard -cclib -static -cclib -lm -O3)))) + (executable - (flags - (:standard -cclib -static -cclib -lm)) (libraries discocaml yojson) (modules main) (name main) diff --git a/discocaml/eval.ml b/discocaml/eval.ml new file mode 100644 index 0000000..68bb637 --- /dev/null +++ b/discocaml/eval.ml @@ -0,0 +1,7 @@ +open Ast + +type path = int list +(** A path from the root of a term to a subterm. *) + +let find_redex_cbv : expr -> path option = function _ -> None +let find_redex_cbn : expr -> path option = function _ -> None -- cgit v1.2.3