aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/runtime.lux
blob: fdccb432a8ba68d98ecc789c6b8225056867e8ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
 [library
  [lux (.except for)
   [abstract
    [equivalence (.only Equivalence)]]
   [data
    ["[0]" product]
    ["[0]" text (.only)
     ["%" \\format (.only format)]]
    [collection
     ["[0]" list (.use "[1]#[0]" monoid)]
     ["[0]" dictionary (.only Dictionary)]]]
   [meta
    [macro
     ["[0]" template]]]
   [world
    ["[0]" file]]]])

(type .public Runtime
  (Record
   [#environment (Dictionary Text Text)
    #program Text
    #parameters (List Text)]))

(def .public equivalence
  (Equivalence Runtime)
  (all product.equivalence
       (dictionary.equivalence text.equivalence)
       text.equivalence
       (list.equivalence text.equivalence)
       ))

(with_template [<name> <command> <environment> <parameters>]
  [(def .public <name>
     Runtime
     [#environment (dictionary.of_list text.hash (`` (list (,, (template.spliced <environment>)))))
      #program <command>
      #parameters (`` (list (,, (template.spliced <parameters>))))])]

  [default_java "java" [] ["-Xss16m" "--add-opens" "java.base/java.lang=ALL-UNNAMED" "-jar"]]
  [default_js "node" [] ["--stack_size=8192"]]
  [default_python "python3" [] []]
  [default_lua "lua" [] []]
  ... 2^23
  [default_ruby "ruby" [["RUBY_THREAD_VM_STACK_SIZE" "8388608"]] []]
  )

(def .public (for runtime path)
  (-> Runtime file.Path Runtime)
  (revised #parameters
           (function (_ parameters)
             (list#composite parameters (list path)))
           runtime))