blob: 58a41c9ba57fd019419223c897dfbd2135ddd7f5 (
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
(.using
[library
[lux (.except Module Source)
[abstract
[monad (.only do)]
[equivalence (.only Equivalence)]]
[control
["[0]" pipe]
["<>" parser
["<[0]>" cli (.only Parser)]
["<[0]>" text]]]
[data
["[0]" product]
["[0]" text
["%" format]]
[collection
["[0]" list ("[1]#[0]" functor)]]]
[macro
["^" pattern]]
[math
[number (.only hex)]]
[meta
["[0]" symbol]
["[0]" configuration (.only Configuration)]]
[tool
[compiler
[meta
[archive
[module
["[0]" descriptor]]]]]]
[world
[file (.only Path)]]]]
["[0]" / "_"
["[1][0]" compiler (.only Compiler)]])
(type: .public Host_Dependency
Path)
(type: .public Library
Path)
(type: .public Source
Path)
(type: .public Target
Path)
(type: .public Module
descriptor.Module)
(type: .public Compilation
(Record
[#host_dependencies (List Host_Dependency)
#libraries (List Library)
#compilers (List Compiler)
#sources (List Source)
#target Target
#module Module
#configuration Configuration]))
(type: .public Interpretation
..Compilation)
(type: .public Export
[(List Source) Target])
(type: .public Service
(Variant
{#Compilation Compilation}
{#Interpretation Interpretation}
{#Export Export}))
(template [<name> <long> <type> <parser>]
[(def: <name>
(Parser <type>)
(<cli>.named <long> <parser>))]
[host_dependency_parser "--host_dependency" Host_Dependency <cli>.any]
[library_parser "--library" Library <cli>.any]
[compiler_parser "--compiler" Compiler (<text>.then /compiler.parser <cli>.any)]
[source_parser "--source" Source <cli>.any]
[target_parser "--target" Target <cli>.any]
[module_parser "--module" Module <cli>.any]
[configuration_parser "--configuration" Configuration (<text>.then configuration.parser <cli>.any)]
)
(def: .public service
(Parser Service)
(let [compilation (is (Parser Compilation)
(all <>.and
(<>.some ..host_dependency_parser)
(<>.some ..library_parser)
(<>.some ..compiler_parser)
(<>.some ..source_parser)
..target_parser
..module_parser
(<>.else configuration.empty ..configuration_parser)))]
(all <>.or
(<>.after (<cli>.this "build")
compilation)
(<>.after (<cli>.this "repl")
compilation)
(<>.after (<cli>.this "export")
(all <>.and
(<>.some ..source_parser)
..target_parser))
)))
(def: .public target
(-> Service Target)
(|>> (pipe.case
(^.or {#Compilation [host_dependencies libraries compilers sources target module]}
{#Interpretation [host_dependencies libraries compilers sources target module]}
{#Export [sources target]})
target)))
|