Skip to content

Commit

Permalink
Initialized dune and AST setup
Browse files Browse the repository at this point in the history
  • Loading branch information
KabirSamsi committed Dec 17, 2023
0 parents commit f9a3814
Show file tree
Hide file tree
Showing 65 changed files with 298 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .ocamlformat
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
profile = conventional
break-fun-decl = fit-or-vertical
exp-grouping = preserve
margin = 72
parse-docstrings = true
type-decl=sparse
wrap-comments = true
Empty file added MaTriX.opam
Empty file.
33 changes: 33 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.PHONY: test check

build:
dune build

utop:
OCAMLRUNPARAM=b dune utop src

test:
OCAMLRUNPARAM=b dune exec test/main.exe

run:
OCAMLRUNPARAM=b dune exec bin/run.exe

repl:
OCAMLRUNPARAM=b dune exec bin/repl.exe

check:
@bash check.sh

finalcheck:
@bash check.sh final

zip:
rm -f rml.zip
zip -r rml.zip . [email protected]

clean:
dune clean
rm -f rml.zip

doc:
dune build @doc
Binary file added _build/.db
Binary file not shown.
Binary file added _build/.digest-db
Binary file not shown.
1 change: 1 addition & 0 deletions _build/.filesystem-clock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<dummy>
1 change: 1 addition & 0 deletions _build/.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16285
2 changes: 2 additions & 0 deletions _build/default/.dune/configurator
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(ocamlc /Users/kabirsamsi/.opam/cs3110-2023fa/bin/ocamlc.opt)
(ocaml_config_vars (afl_instrument false) (architecture arm64) (asm "cc -c -Wno-trigraphs") (asm_cfi_supported true) (ast_impl_magic_number Caml1999M032) (ast_intf_magic_number Caml1999N032) (bytecomp_c_compiler "cc -O2 -fno-strict-aliasing -fwrapv -pthread -D_FILE_OFFSET_BITS=64 ") (bytecomp_c_libraries "-lm -lpthread") (c_compiler cc) (ccomp_type cc) (cma_magic_number Caml1999A032) (cmi_magic_number Caml1999I032) (cmo_magic_number Caml1999O032) (cmt_magic_number Caml1999T032) (cmx_magic_number Caml1999Y032) (cmxa_magic_number Caml1999Z032) (cmxs_magic_number Caml1999D032) (default_executable_name a.out) (default_safe_string true) (exec_magic_number Caml1999X032) (ext_asm .s) (ext_dll .so) (ext_exe "") (ext_lib .a) (ext_obj .o) (flambda false) (flat_float_array true) (function_sections false) (host aarch64-apple-darwin21.6.0) (int_size 63) (linear_magic_number Caml1999L032) (model default) (naked_pointers false) (native_c_compiler "cc -O2 -fno-strict-aliasing -fwrapv -pthread -D_FILE_OFFSET_BITS=64 ") (native_c_libraries "-lm -lpthread") (native_pack_linker "ld -r -o ") (ocamlc_cflags "-O2 -fno-strict-aliasing -fwrapv -pthread ") (ocamlc_cppflags "-D_FILE_OFFSET_BITS=64 ") (ocamlopt_cflags "-O2 -fno-strict-aliasing -fwrapv -pthread ") (ocamlopt_cppflags "-D_FILE_OFFSET_BITS=64 ") (os_type Unix) (safe_string true) (standard_library /Users/kabirsamsi/.opam/cs3110-2023fa/lib/ocaml) (standard_library_default /Users/kabirsamsi/.opam/cs3110-2023fa/lib/ocaml) (supports_shared_libraries true) (system macosx) (systhread_supported true) (target aarch64-apple-darwin21.6.0) (version 5.0.0) (windows_unicode false) (with_frame_pointers false) (word_size 64))
1 change: 1 addition & 0 deletions _build/default/.dune/configurator.v2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
((6:ocamlc52:/Users/kabirsamsi/.opam/cs3110-2023fa/bin/ocamlc.opt)(17:ocaml_config_vars((14:afl_instrument5:false)(12:architecture5:arm64)(3:asm20:cc -c -Wno-trigraphs)(17:asm_cfi_supported4:true)(21:ast_impl_magic_number12:Caml1999M032)(21:ast_intf_magic_number12:Caml1999N032)(19:bytecomp_c_compiler70:cc -O2 -fno-strict-aliasing -fwrapv -pthread -D_FILE_OFFSET_BITS=64 )(20:bytecomp_c_libraries14:-lm -lpthread)(10:c_compiler2:cc)(10:ccomp_type2:cc)(16:cma_magic_number12:Caml1999A032)(16:cmi_magic_number12:Caml1999I032)(16:cmo_magic_number12:Caml1999O032)(16:cmt_magic_number12:Caml1999T032)(16:cmx_magic_number12:Caml1999Y032)(17:cmxa_magic_number12:Caml1999Z032)(17:cmxs_magic_number12:Caml1999D032)(23:default_executable_name5:a.out)(19:default_safe_string4:true)(17:exec_magic_number12:Caml1999X032)(7:ext_asm2:.s)(7:ext_dll3:.so)(7:ext_exe0:)(7:ext_lib2:.a)(7:ext_obj2:.o)(7:flambda5:false)(16:flat_float_array4:true)(17:function_sections5:false)(4:host26:aarch64-apple-darwin21.6.0)(8:int_size2:63)(19:linear_magic_number12:Caml1999L032)(5:model7:default)(14:naked_pointers5:false)(17:native_c_compiler70:cc -O2 -fno-strict-aliasing -fwrapv -pthread -D_FILE_OFFSET_BITS=64 )(18:native_c_libraries14:-lm -lpthread)(18:native_pack_linker9:ld -r -o )(13:ocamlc_cflags43:-O2 -fno-strict-aliasing -fwrapv -pthread )(15:ocamlc_cppflags23:-D_FILE_OFFSET_BITS=64 )(15:ocamlopt_cflags43:-O2 -fno-strict-aliasing -fwrapv -pthread )(17:ocamlopt_cppflags23:-D_FILE_OFFSET_BITS=64 )(7:os_type4:Unix)(11:safe_string4:true)(16:standard_library47:/Users/kabirsamsi/.opam/cs3110-2023fa/lib/ocaml)(24:standard_library_default47:/Users/kabirsamsi/.opam/cs3110-2023fa/lib/ocaml)(25:supports_shared_libraries4:true)(6:system6:macosx)(19:systhread_supported4:true)(6:target26:aarch64-apple-darwin21.6.0)(7:version5:5.0.0)(15:windows_unicode5:false)(19:with_frame_pointers5:false)(9:word_size2:64))))
6 changes: 6 additions & 0 deletions _build/default/META.MaTriX
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
description = ""
requires = "menhirLib str"
archive(byte) = "matrix.cma"
archive(native) = "matrix.cmxa"
plugin(byte) = "matrix.cma"
plugin(native) = "matrix.cmxs"
44 changes: 44 additions & 0 deletions _build/default/MaTriX.dune-package
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
(lang dune 3.10)
(name MaTriX)
(sections (lib .) (libexec .))
(files
(lib
(META
ast.ml
dune-package
matrix.a
matrix.cma
matrix.cmi
matrix.cmt
matrix.cmx
matrix.cmxa
matrix.ml
matrix__Ast.cmi
matrix__Ast.cmt
matrix__Ast.cmx
opam))
(libexec (matrix.cmxs)))
(library
(name MaTriX)
(kind normal)
(archives (byte matrix.cma) (native matrix.cmxa))
(plugins (byte matrix.cma) (native matrix.cmxs))
(native_archives matrix.a)
(requires str menhirLib)
(main_module_name Matrix)
(modes byte native)
(modules
(wrapped
(group
(alias
(obj_name matrix)
(visibility public)
(kind alias)
(source (path Matrix) (impl (path matrix.ml-gen))))
(name Matrix)
(modules
(module
(obj_name matrix__Ast)
(visibility public)
(source (path Ast) (impl (path ast.ml))))))
(wrapped true))))
19 changes: 19 additions & 0 deletions _build/default/MaTriX.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
lib: [
"_build/install/default/lib/MaTriX/META"
"_build/install/default/lib/MaTriX/ast.ml"
"_build/install/default/lib/MaTriX/dune-package"
"_build/install/default/lib/MaTriX/matrix.a"
"_build/install/default/lib/MaTriX/matrix.cma"
"_build/install/default/lib/MaTriX/matrix.cmi"
"_build/install/default/lib/MaTriX/matrix.cmt"
"_build/install/default/lib/MaTriX/matrix.cmx"
"_build/install/default/lib/MaTriX/matrix.cmxa"
"_build/install/default/lib/MaTriX/matrix.ml"
"_build/install/default/lib/MaTriX/matrix__Ast.cmi"
"_build/install/default/lib/MaTriX/matrix__Ast.cmt"
"_build/install/default/lib/MaTriX/matrix__Ast.cmx"
"_build/install/default/lib/MaTriX/opam"
]
libexec: [
"_build/install/default/lib/MaTriX/matrix.cmxs"
]
Empty file added _build/default/MaTriX.opam
Empty file.
Binary file added _build/default/src/.matrix.objs/byte/matrix.cmi
Binary file not shown.
Binary file added _build/default/src/.matrix.objs/byte/matrix.cmo
Binary file not shown.
Binary file added _build/default/src/.matrix.objs/byte/matrix.cmt
Binary file not shown.
Binary file added _build/default/src/.matrix.objs/byte/matrix__Ast.cmi
Binary file not shown.
Binary file not shown.
Binary file not shown.
Empty file.
1 change: 1 addition & 0 deletions _build/default/src/.matrix.objs/matrix__Ast.impl.d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/ast.ml:
Binary file added _build/default/src/.matrix.objs/native/matrix.cmx
Binary file not shown.
Binary file added _build/default/src/.matrix.objs/native/matrix.o
Binary file not shown.
Binary file not shown.
Binary file added _build/default/src/.matrix.objs/native/matrix__Ast.o
Binary file not shown.
Binary file added _build/default/src/.merlin-conf/lib-MaTriX
Binary file not shown.
4 changes: 4 additions & 0 deletions _build/default/src/ast.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
type k = string



Binary file added _build/default/src/matrix.a
Binary file not shown.
Binary file added _build/default/src/matrix.cma
Binary file not shown.
Binary file added _build/default/src/matrix.cmxa
Binary file not shown.
Binary file added _build/default/src/matrix.cmxs
Binary file not shown.
4 changes: 4 additions & 0 deletions _build/default/src/matrix.ml-gen
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(* generated by dune *)

(** @canonical Matrix.Ast *)
module Ast = Matrix__Ast
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added _build/default/test/.merlin-conf/exe-main
Binary file not shown.
Binary file added _build/default/test/main.exe
Binary file not shown.
Empty file added _build/default/test/main.ml
Empty file.
1 change: 1 addition & 0 deletions _build/default/test/main.mli
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(* Auto-generated by Dune *)
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/META
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/ast.ml
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/dune-package
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/matrix.a
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/matrix.cma
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/matrix.cmi
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/matrix.cmt
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/matrix.cmx
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/matrix.cmxa
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/matrix.cmxs
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/matrix.ml
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/matrix__Ast.cmi
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/matrix__Ast.cmt
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/matrix__Ast.cmx
1 change: 1 addition & 0 deletions _build/install/default/lib/MaTriX/opam
119 changes: 119 additions & 0 deletions _build/log
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
# dune exec test/main.exe
# OCAMLPARAM: unset
# Shared cache: disabled
# Workspace root: "/Users/kabirsamsi/Desktop/Software Projects/PL/MaTriX"
# Auto-detected concurrency: 8
$ /Users/kabirsamsi/.opam/cs3110-2023fa/bin/ocamlc.opt -config > /var/folders/q2/dq7hmqnn4_18ng02v_hkwqpc0000gn/T/dune_bb5d56_output
# Dune context:
# { name = "default"
# ; kind = "default"
# ; profile = Dev
# ; merlin = true
# ; for_host = None
# ; fdo_target_exe = None
# ; build_dir = In_build_dir "default"
# ; ocaml_bin = External "/Users/kabirsamsi/.opam/cs3110-2023fa/bin"
# ; ocaml = Ok External "/Users/kabirsamsi/.opam/cs3110-2023fa/bin/ocaml"
# ; ocamlc = External "/Users/kabirsamsi/.opam/cs3110-2023fa/bin/ocamlc.opt"
# ; ocamlopt =
# Ok External "/Users/kabirsamsi/.opam/cs3110-2023fa/bin/ocamlopt.opt"
# ; ocamldep =
# Ok External "/Users/kabirsamsi/.opam/cs3110-2023fa/bin/ocamldep.opt"
# ; ocamlmklib =
# Ok External "/Users/kabirsamsi/.opam/cs3110-2023fa/bin/ocamlmklib.opt"
# ; env =
# map
# { "DUNE_OCAML_HARDCODED" :
# "/Users/kabirsamsi/.opam/cs3110-2023fa/lib/ocaml:/Users/kabirsamsi/.opam/cs3110-2023fa/lib"
# ; "DUNE_OCAML_STDLIB" :
# "/Users/kabirsamsi/.opam/cs3110-2023fa/lib/ocaml"
# ; "DUNE_SOURCEROOT" :
# "/Users/kabirsamsi/Desktop/Software Projects/PL/MaTriX"
# ; "INSIDE_DUNE" :
# "/Users/kabirsamsi/Desktop/Software Projects/PL/MaTriX/_build/default"
# ; "OCAMLFIND_IGNORE_DUPS_IN" :
# "/Users/kabirsamsi/Desktop/Software Projects/PL/MaTriX/_build/install/default/lib"
# ; "OCAMLPATH" :
# "/Users/kabirsamsi/Desktop/Software Projects/PL/MaTriX/_build/install/default/lib"
# ; "OCAMLTOP_INCLUDE_PATH" :
# "/Users/kabirsamsi/Desktop/Software Projects/PL/MaTriX/_build/install/default/lib/toplevel"
# ; "OCAML_COLOR" : "always"
# ; "OPAMCOLOR" : "always"
# }
# ; findlib_paths =
# [ External "/Users/kabirsamsi/.opam/cs3110-2023fa/lib/ocaml"
# ; External "/Users/kabirsamsi/.opam/cs3110-2023fa/lib"
# ]
# ; natdynlink_supported = true
# ; supports_shared_libraries = true
# ; ocaml_config =
# { version = "5.0.0"
# ; standard_library_default =
# "/Users/kabirsamsi/.opam/cs3110-2023fa/lib/ocaml"
# ; standard_library = "/Users/kabirsamsi/.opam/cs3110-2023fa/lib/ocaml"
# ; standard_runtime = "the_standard_runtime_variable_was_deleted"
# ; ccomp_type = "cc"
# ; c_compiler = "cc"
# ; ocamlc_cflags =
# [ "-O2"; "-fno-strict-aliasing"; "-fwrapv"; "-pthread" ]
# ; ocamlc_cppflags = [ "-D_FILE_OFFSET_BITS=64" ]
# ; ocamlopt_cflags =
# [ "-O2"; "-fno-strict-aliasing"; "-fwrapv"; "-pthread" ]
# ; ocamlopt_cppflags = [ "-D_FILE_OFFSET_BITS=64" ]
# ; bytecomp_c_compiler =
# [ "cc"
# ; "-O2"
# ; "-fno-strict-aliasing"
# ; "-fwrapv"
# ; "-pthread"
# ; "-D_FILE_OFFSET_BITS=64"
# ]
# ; bytecomp_c_libraries = [ "-lm"; "-lpthread" ]
# ; native_c_compiler =
# [ "cc"
# ; "-O2"
# ; "-fno-strict-aliasing"
# ; "-fwrapv"
# ; "-pthread"
# ; "-D_FILE_OFFSET_BITS=64"
# ]
# ; native_c_libraries = [ "-lm"; "-lpthread" ]
# ; native_pack_linker = [ "ld"; "-r"; "-o" ]
# ; cc_profile = []
# ; architecture = "arm64"
# ; model = "default"
# ; int_size = 63
# ; word_size = 64
# ; system = "macosx"
# ; asm = [ "cc"; "-c"; "-Wno-trigraphs" ]
# ; asm_cfi_supported = true
# ; with_frame_pointers = false
# ; ext_exe = ""
# ; ext_obj = ".o"
# ; ext_asm = ".s"
# ; ext_lib = ".a"
# ; ext_dll = ".so"
# ; os_type = "Unix"
# ; default_executable_name = "a.out"
# ; systhread_supported = true
# ; host = "aarch64-apple-darwin21.6.0"
# ; target = "aarch64-apple-darwin21.6.0"
# ; profiling = false
# ; flambda = false
# ; spacetime = false
# ; safe_string = true
# ; exec_magic_number = "Caml1999X032"
# ; cmi_magic_number = "Caml1999I032"
# ; cmo_magic_number = "Caml1999O032"
# ; cma_magic_number = "Caml1999A032"
# ; cmx_magic_number = "Caml1999Y032"
# ; cmxa_magic_number = "Caml1999Z032"
# ; ast_impl_magic_number = "Caml1999M032"
# ; ast_intf_magic_number = "Caml1999N032"
# ; cmxs_magic_number = "Caml1999D032"
# ; cmt_magic_number = "Caml1999T032"
# ; natdynlink_supported = true
# ; supports_shared_libraries = true
# ; windows_unicode = false
# }
# }
4 changes: 4 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(env
(dev
(flags ;; Change the compile flags to the [ocamlc] defaults
(-w +a-4-6-7-9-27-29-30-32..42-44-45-48-50-60-66..70 -warn-error -a+31))))
3 changes: 3 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(lang dune 3.4)
(name matrix)
(using menhir 2.0)
5 changes: 5 additions & 0 deletions dune-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(lang dune 3.4)

(context default)

(profile dev)
4 changes: 4 additions & 0 deletions exclude.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
_build/*
tutorial/*
.DS_Store
*.zip
17 changes: 17 additions & 0 deletions src/ast.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
type factorization = LU | CR | PDP | QR | SVD;;

type expr =
| Empty
| Int of int
| Float of float
| Size of expr
| Vector of expr * expr * expr
| Matrix of expr * expr * expr
| VSpace of expr * expr
| UopExpr of uop * expr
| BopExpr of bop * expr * expr
| Factorization of factorization * expr

and uop =Det | Dimensions | Inverse | REF | RREF | Transpose | Eigenvalues | Eigenvectors

and bop = Add | Multiply | ScalarMultiply | Solve;;
4 changes: 4 additions & 0 deletions src/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(library
(name matrix)
(public_name MaTriX)
(libraries str menhirLib))
Empty file added src/eval.ml
Empty file.
3 changes: 3 additions & 0 deletions test/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(executable
(name main)
(libraries MaTriX ounit2))
Empty file added test/main.ml
Empty file.

0 comments on commit f9a3814

Please sign in to comment.