feat: lift runtime into language, start of zelus 2024 compatibility
This commit is contained in:
parent
dc8d941b84
commit
ffc583985a
37 changed files with 1154 additions and 143 deletions
21
exm/zelus/ball/ball.zls
Normal file
21
exm/zelus/ball/ball.zls
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
let g = 9.81
|
||||
let y0 = 0.0
|
||||
let y'0 = 10.0
|
||||
|
||||
let hybrid ball () = (y, y', z) where
|
||||
rec der y = y' init y0
|
||||
and der y' = -. g init y'0 reset z -> -0.8 *. (last y')
|
||||
and z = up(-. y)
|
||||
|
||||
let hybrid main () =
|
||||
let der t = 1.0 init 0.0 in
|
||||
let s = period(0.01) in
|
||||
let (y, y', z) = ball () in
|
||||
present z | s -> (
|
||||
print_float t;
|
||||
print_string "\t";
|
||||
print_float y;
|
||||
(* print_string "\t";
|
||||
print_float y'; *)
|
||||
print_newline ()
|
||||
); ()
|
||||
16
exm/zelus/ball/dune
Normal file
16
exm/zelus/ball/dune
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
(env
|
||||
(dev
|
||||
(flags
|
||||
(:standard -w -a))))
|
||||
|
||||
(rule
|
||||
(targets ball.ml ball.zci)
|
||||
(deps
|
||||
(:zl ball.zls))
|
||||
(action
|
||||
(run zeluc %{zl})))
|
||||
|
||||
(executable
|
||||
(public_name ball.exe)
|
||||
(name main)
|
||||
(libraries std))
|
||||
6
exm/zelus/ball/main.ml
Normal file
6
exm/zelus/ball/main.ml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
|
||||
open Std
|
||||
|
||||
let input _ = ()
|
||||
let output (now, (y, _, _)) = Format.printf "%.10e\t%.10e\n" now y
|
||||
let () = Runtime.go input Ball.ball output
|
||||
12
exm/zelus/ball/ztypes.ml
Normal file
12
exm/zelus/ball/ztypes.ml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
include Std
|
||||
include Ztypes
|
||||
include Solvers
|
||||
|
||||
module type IGNORE = sig end
|
||||
module Defaultsolver : IGNORE = struct end
|
||||
|
||||
module Zlsrun = struct
|
||||
module Make (S : IGNORE) = struct
|
||||
let go _ = ()
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue