projct structure refactoring

This commit is contained in:
ProgramSnail 2026-02-22 13:17:41 +00:00
parent 3f6844835c
commit 8885c4891c
11 changed files with 109 additions and 141 deletions

23
camlp5/dune Normal file
View file

@ -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})))

109
lib/dune
View file

@ -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})))

View file

@ -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

83
simplest_model/dune Normal file
View file

@ -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)))

View file

@ -1,5 +1,5 @@
open Relational_interpreter_oc_tests_f open Tests_f
open Relational_semantic_interpreter_oc open Synthesizer
open Relational open Relational
let%expect_test "inv id: test 1" = print_endline (inv_id_t ()); [%expect {| [O] |}] let%expect_test "inv id: test 1" = print_endline (inv_id_t ()); [%expect {| [O] |}]

View file

@ -1,4 +1,4 @@
open Relational_semantic_interpreter_oc open Synthesizer
open Relational open Relational
open GT open GT
open OCanren open OCanren