From 8885c4891c8bf31094a11ca9f1dd1fe728c32843 Mon Sep 17 00:00:00 2001 From: ProgramSnail Date: Sun, 22 Feb 2026 13:17:41 +0000 Subject: [PATCH] projct structure refactoring --- camlp5/dune | 23 ++++ .../old_model_init.ml | 0 .../simplest_model_init.ml | 0 lib/dune | 109 ------------------ lib/test.ml | 29 ----- .../analyzer.ml | 0 simplest_model/dune | 83 +++++++++++++ {lib => simplest_model}/parser.ml | 0 .../synthesizer.ml | 0 .../tests.ml | 4 +- .../tests_f.ml | 2 +- 11 files changed, 109 insertions(+), 141 deletions(-) create mode 100644 camlp5/dune rename lib/lib_next.ml => experiments/old_model_init.ml (100%) rename lib/lib.ml => experiments/simplest_model_init.ml (100%) delete mode 100644 lib/dune delete mode 100644 lib/test.ml rename lib/semantic_interpreter.ml => simplest_model/analyzer.ml (100%) create mode 100644 simplest_model/dune rename {lib => simplest_model}/parser.ml (100%) rename lib/relational_semantic_interpreter_oc.ml => simplest_model/synthesizer.ml (100%) rename lib/relational_interpreter_oc_tests.ml => simplest_model/tests.ml (98%) rename lib/relational_interpreter_oc_tests_f.ml => simplest_model/tests_f.ml (99%) diff --git a/camlp5/dune b/camlp5/dune new file mode 100644 index 0000000..f0a99a9 --- /dev/null +++ b/camlp5/dune @@ -0,0 +1,23 @@ +(rule + (targets pp5+gt+plugins+ocanren+dump.exe) + (action + (run + mkcamlp5.opt + -package + camlp5,camlp5.pa_o,camlp5.macro,camlp5.pr_dump,logger.syntax + -package + logger.syntax,GT.syntax,GT.syntax.all,OCanren.syntax + -o + %{targets}))) + +(rule + (targets pp5+gt+plugins+ostap+dump.exe) + (action + (run + mkcamlp5.opt + -package + camlp5,camlp5.pa_o,camlp5.macro,camlp5.pr_dump,logger.syntax + -package + logger.syntax,GT.syntax,GT.syntax.all,ostap.syntax + -o + %{targets}))) diff --git a/lib/lib_next.ml b/experiments/old_model_init.ml similarity index 100% rename from lib/lib_next.ml rename to experiments/old_model_init.ml diff --git a/lib/lib.ml b/experiments/simplest_model_init.ml similarity index 100% rename from lib/lib.ml rename to experiments/simplest_model_init.ml diff --git a/lib/dune b/lib/dune deleted file mode 100644 index 3178596..0000000 --- a/lib/dune +++ /dev/null @@ -1,109 +0,0 @@ -; (env -; (_ -; (flags -; (:standard -warn-error +5)))) - -(library - (name semantic_interpreter) - (modules semantic_interpreter) - (flags (-rectypes)) - (libraries OCanren OCanren.tester) - (inline_tests) - (wrapped false) - (preprocess - (pps GT.ppx GT.ppx_all ppx_expect ppx_inline_test))) - -(library - (name relational_interpreter_oc_tests) - (modules relational_interpreter_oc_tests) - (flags (-rectypes)) - (libraries - relational_semantic_interpreter_oc - relational_interpreter_oc_tests_f) - (inline_tests) - (wrapped false) - (preprocess - (pps ppx_expect ppx_inline_test))) - -(library - (name relational_interpreter_oc_tests_f) - (modules relational_interpreter_oc_tests_f) - (flags (-rectypes)) - (libraries OCanren OCanren.tester relational_semantic_interpreter_oc) - (preprocessor_deps ./pp5+gt+plugins+ocanren+dump.exe) - (wrapped false) - (preprocess - (pps - OCanren-ppx.ppx_repr - OCanren-ppx.ppx_deriving_reify - OCanren-ppx.ppx_fresh - GT.ppx - GT.ppx_all - OCanren-ppx.ppx_distrib - -- - -pp - lib/pp5+gt+plugins+ocanren+dump.exe))) - -(library - (name relational_semantic_interpreter_oc) - (modules relational_semantic_interpreter_oc) - (flags - ; (-dsource) - (:standard -rectypes)) - (libraries OCanren OCanren.tester) - (preprocessor_deps ./pp5+gt+plugins+ocanren+dump.exe) - (wrapped false) - (preprocess - (pps - OCanren-ppx.ppx_repr - OCanren-ppx.ppx_deriving_reify - OCanren-ppx.ppx_fresh - GT.ppx - GT.ppx_all - OCanren-ppx.ppx_distrib - -- - -pp - lib/pp5+gt+plugins+ocanren+dump.exe))) - -(library - (name parser) - (modules parser) - (flags - ; (-dsource) - (:standard -rectypes)) - (libraries ostap GT) - (preprocessor_deps ./pp5+gt+plugins+ostap+dump.exe) - (wrapped false) - (preprocess - (pps - ppx_expect - ppx_inline_test - GT.ppx - GT.ppx_all - -- - -pp - lib/pp5+gt+plugins+ostap+dump.exe))) - -(rule - (targets pp5+gt+plugins+ocanren+dump.exe) - (action - (run - mkcamlp5.opt - -package - camlp5,camlp5.pa_o,camlp5.macro,camlp5.pr_dump,logger.syntax - -package - logger.syntax,GT.syntax,GT.syntax.all,OCanren.syntax - -o - %{targets}))) - -(rule - (targets pp5+gt+plugins+ostap+dump.exe) - (action - (run - mkcamlp5.opt - -package - camlp5,camlp5.pa_o,camlp5.macro,camlp5.pr_dump,logger.syntax - -package - logger.syntax,GT.syntax,GT.syntax.all,ostap.syntax - -o - %{targets}))) diff --git a/lib/test.ml b/lib/test.ml deleted file mode 100644 index 97a75c4..0000000 --- a/lib/test.ml +++ /dev/null @@ -1,29 +0,0 @@ -open GT -open OCanren - -module Tag = struct - [@@@warning "-26-27-32-33-34-35-36-37-38-39-60-66-67"] - ocanren type tag = Ref | Value - - module Test = struct - @type answer = logic GT.list with show - - let _ = - Printf.printf "%s" @@ show(answer) (Stream.take (run q (fun q -> ocanren {q === Ref}) - (fun q -> q#reify reify))) - end -end - -module Stmt = struct - ocanren type ('d, 'dl) stmt = Call of 'd * 'dl | Read of 'd | Write of 'd - - module Test = struct - @type answer1 = Nat.ground List.ground GT.list with show - @type answer = (Nat.ground, Nat.ground List.ground) ground GT.list with show - let _ = Printf.printf "%s\n" @@ show(answer1) (Stream.take (run q (fun q -> ocanren {Call (1, [2]) === Call (1, q)}) - (fun q -> q#reify (List.prj_exn Nat.prj_exn)))) - - let _ = Printf.printf "%s\n" @@ show(answer) (Stream.take (run q (fun q -> ocanren {Call (1, [2]) === q}) - (fun q -> q#reify (prj_exn Nat.prj_exn (List.prj_exn Nat.prj_exn))))) - end -end diff --git a/lib/semantic_interpreter.ml b/simplest_model/analyzer.ml similarity index 100% rename from lib/semantic_interpreter.ml rename to simplest_model/analyzer.ml diff --git a/simplest_model/dune b/simplest_model/dune new file mode 100644 index 0000000..a086c48 --- /dev/null +++ b/simplest_model/dune @@ -0,0 +1,83 @@ +; (env +; (_ +; (flags +; (:standard -warn-error +5)))) + +(library + (name analyzer) + (modules analyzer) + (flags (-rectypes)) + (libraries OCanren OCanren.tester) + (inline_tests) + (wrapped false) + (preprocess + (pps GT.ppx GT.ppx_all ppx_expect ppx_inline_test))) + +(library + (name tests) + (modules tests) + (flags (-rectypes)) + (libraries synthesizer tests_f) + (inline_tests) + (wrapped false) + (preprocess + (pps ppx_expect ppx_inline_test))) + +(library + (name tests_f) + (modules tests_f) + (flags (-rectypes)) + (libraries OCanren OCanren.tester synthesizer) + (preprocessor_deps ../camlp5/pp5+gt+plugins+ocanren+dump.exe) + (wrapped false) + (preprocess + (pps + OCanren-ppx.ppx_repr + OCanren-ppx.ppx_deriving_reify + OCanren-ppx.ppx_fresh + GT.ppx + GT.ppx_all + OCanren-ppx.ppx_distrib + -- + -pp + camlp5/pp5+gt+plugins+ocanren+dump.exe))) + +(library + (name synthesizer) + (modules synthesizer) + (flags + ; (-dsource) + (:standard -rectypes)) + (libraries OCanren OCanren.tester) + (preprocessor_deps ../camlp5/pp5+gt+plugins+ocanren+dump.exe) + (wrapped false) + (preprocess + (pps + OCanren-ppx.ppx_repr + OCanren-ppx.ppx_deriving_reify + OCanren-ppx.ppx_fresh + GT.ppx + GT.ppx_all + OCanren-ppx.ppx_distrib + -- + -pp + camlp5/pp5+gt+plugins+ocanren+dump.exe))) + +(library + (name parser) + (modules parser) + (flags + ; (-dsource) + (:standard -rectypes)) + (libraries ostap GT) + (preprocessor_deps ../camlp5/pp5+gt+plugins+ostap+dump.exe) + (wrapped false) + (preprocess + (pps + ppx_expect + ppx_inline_test + GT.ppx + GT.ppx_all + -- + -pp + camlp5/pp5+gt+plugins+ostap+dump.exe))) diff --git a/lib/parser.ml b/simplest_model/parser.ml similarity index 100% rename from lib/parser.ml rename to simplest_model/parser.ml diff --git a/lib/relational_semantic_interpreter_oc.ml b/simplest_model/synthesizer.ml similarity index 100% rename from lib/relational_semantic_interpreter_oc.ml rename to simplest_model/synthesizer.ml diff --git a/lib/relational_interpreter_oc_tests.ml b/simplest_model/tests.ml similarity index 98% rename from lib/relational_interpreter_oc_tests.ml rename to simplest_model/tests.ml index c888c92..5da7fe0 100644 --- a/lib/relational_interpreter_oc_tests.ml +++ b/simplest_model/tests.ml @@ -1,5 +1,5 @@ -open Relational_interpreter_oc_tests_f -open Relational_semantic_interpreter_oc +open Tests_f +open Synthesizer open Relational let%expect_test "inv id: test 1" = print_endline (inv_id_t ()); [%expect {| [O] |}] diff --git a/lib/relational_interpreter_oc_tests_f.ml b/simplest_model/tests_f.ml similarity index 99% rename from lib/relational_interpreter_oc_tests_f.ml rename to simplest_model/tests_f.ml index f33e1e5..3c1a8a0 100644 --- a/lib/relational_interpreter_oc_tests_f.ml +++ b/simplest_model/tests_f.ml @@ -1,4 +1,4 @@ -open Relational_semantic_interpreter_oc +open Synthesizer open Relational open GT open OCanren