Skip to content

Commit c31725b

Browse files
committed
Progress on getting self-hosted compiler broker/worker system going.
This will let us run different passes of the compiler as different workers, connecting to a common broker to interact with one another.
1 parent 73eb7bd commit c31725b

19 files changed

+2121
-59
lines changed

Makefile

+15-4
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ example.deps: PHONY SAVI
9999

100100
# Generate Savi and Crystal source code from CapnProto definitions.
101101
gen.capnp: PHONY self-hosted.deps $(BUILD)/capnpc-savi $(BUILD)/capnpc-crystal
102+
capnp compile \
103+
-I"$(shell find self-hosted/deps/github:jemc-savi/CapnProto/* -name src | sort -r -V | head -n 1)/" \
104+
self-hosted/src/SaviProto/SaviProto.Artifact.capnp --output=- \
105+
| $(BUILD)/capnpc-savi > self-hosted/src/SaviProto/SaviProto.Artifact.capnp.savi
102106
capnp compile \
103107
-I"$(shell find self-hosted/deps/github:jemc-savi/CapnProto/* -name src | sort -r -V | head -n 1)/" \
104108
self-hosted/src/SaviProto/SaviProto.AST.capnp --output=- \
@@ -111,20 +115,27 @@ gen.capnp: PHONY self-hosted.deps $(BUILD)/capnpc-savi $(BUILD)/capnpc-crystal
111115
-I"$(shell find self-hosted/deps/github:jemc-savi/CapnProto/* -name src | sort -r -V | head -n 1)/" \
112116
self-hosted/src/SaviProto/SaviProto.AST.capnp --output=- \
113117
| $(BUILD)/capnpc-crystal > self-hosted/src/SaviProto/SaviProto.AST.capnp.cr
118+
capnp compile \
119+
-I"$(shell find self-hosted/deps/github:jemc-savi/CapnProto/* -name src | sort -r -V | head -n 1)/" \
120+
self-hosted/src/SaviProto/SaviProto.Artifact.capnp --output=- \
121+
| $(BUILD)/capnpc-crystal > self-hosted/src/SaviProto/SaviProto.Artifact.capnp.cr
114122
capnp compile \
115123
-I"$(shell find self-hosted/deps/github:jemc-savi/CapnProto/* -name src | sort -r -V | head -n 1)/" \
116124
self-hosted/src/SaviProto/SaviProto.Source.capnp --output=- \
117125
| $(BUILD)/capnpc-crystal > self-hosted/src/SaviProto/SaviProto.Source.capnp.cr
118126
gen.capnp.check: gen.capnp
119127
git diff --exit-code self-hosted/src/SaviProto
120128

121-
# Update deps for the Self-hosted Savi subprograms.
129+
# Update deps for the Self-hosted Savi compiler subprograms.
122130
self-hosted.deps: PHONY SAVI
131+
echo && $(SAVI) deps update --cd self-hosted --for savi-lang-broker
123132
echo && $(SAVI) deps update --cd self-hosted --for savi-lang-parse
124133

125-
# Create the self-hosted Savi parse subprogram.
126-
self-hosted/bin/savi-lang-parse: $(SAVI) $(shell find self-hosted/src/savi-lang-parse self-hosted/src/SaviProto -name '*.savi')
127-
echo && $(SAVI) --cd self-hosted savi-lang-parse --print-perf --backtrace
134+
# Create the self-hosted Savi compiler subprograms.
135+
self-hosted/bin/savi-lang-broker: $(SAVI) $(shell find self-hosted/src/savi-lang-broker self-hosted/src/SaviWorker self-hosted/src/SaviProto -name '*.savi')
136+
echo && $(SAVI) build --cd self-hosted savi-lang-broker --print-perf --backtrace
137+
self-hosted/bin/savi-lang-parse: $(SAVI) $(shell find self-hosted/src/savi-lang-parse self-hosted/src/SaviWorker self-hosted/src/SaviProto -name '*.savi')
138+
echo && $(SAVI) build --cd self-hosted savi-lang-parse --print-perf --backtrace
128139

129140
# Run spec scripts for self-hosted Savi subprograms.
130141
spec.self-hosted: PHONY self-hosted/bin/$(name)

self-hosted/manifest.savi

+54-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
:manifest bin "savi-lang-parse"
2-
:sources "src/savi-lang-parse/*.savi"
3-
:sources "src/SaviProto/*.savi"
1+
:manifest lib SaviWorker
2+
:sources "src/SaviWorker/*.savi"
3+
:sources "src/SaviProto/SaviProto.Source.capnp.savi"
4+
:sources "src/SaviProto/SaviProto.Artifact.capnp.savi"
5+
:sources "src/SaviProto/SaviProto.Artifact.Path.savi"
46

57
:dependency CapnProto v0
68
:from "github:jemc-savi/CapnProto"
@@ -9,25 +11,67 @@
911
:dependency Map v0
1012
:from "github:savi-lang/Map"
1113

12-
:dependency PEG v0
13-
:from "github:savi-lang/PEG"
14-
1514
:dependency Time v0
1615
:from "github:savi-lang/Time"
1716

18-
:dependency StdIn v0
19-
:from "github:savi-lang/StdIn"
17+
:dependency Timer v0
18+
:from "github:savi-lang/Timer"
19+
:depends on Time
20+
21+
:dependency CLI v0
22+
:from "github:savi-lang/CLI"
23+
:depends on Map
24+
25+
:dependency Logger v0
26+
:from "github:savi-lang/Logger"
27+
:depends on Time
28+
29+
:dependency IO v0
30+
:from "github:savi-lang/IO"
31+
:depends on ByteStream
32+
:depends on OSError
33+
34+
:dependency TCP v0
35+
:from "github:savi-lang/TCP"
2036
:depends on ByteStream
2137
:depends on IO
2238
:depends on OSError
39+
:depends on IPAddress
2340

24-
:dependency IO v0
25-
:from "github:savi-lang/IO"
41+
:dependency StdIn v0
42+
:from "github:savi-lang/StdIn"
2643
:depends on ByteStream
44+
:depends on IO
2745
:depends on OSError
2846

47+
:transitive dependency Time v0
48+
:from "github:savi-lang/Time"
49+
2950
:transitive dependency ByteStream v0
3051
:from "github:savi-lang/ByteStream"
3152

3253
:transitive dependency OSError v0
3354
:from "github:savi-lang/OSError"
55+
56+
:transitive dependency IPAddress v0
57+
:from "github:savi-lang/IPAddress"
58+
59+
:dependency File v0
60+
:from "github:savi-lang/File"
61+
:depends on OSError
62+
:depends on Time
63+
:depends on IO
64+
:depends on ByteStream
65+
:depends on Map
66+
67+
:manifest bin "savi-lang-broker"
68+
:sources "src/savi-lang-broker/*.savi"
69+
:copies SaviWorker
70+
71+
:manifest bin "savi-lang-parse"
72+
:sources "src/savi-lang-parse/*.savi"
73+
:sources "src/SaviProto/SaviProto.AST.capnp.savi"
74+
:copies SaviWorker
75+
76+
:dependency PEG v0
77+
:from "github:savi-lang/PEG"

self-hosted/spec/savi-lang-parse.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@ cd -- "$(dirname -- "$0")"
55
set -e
66

77
find savi-lang-parse -name '*.savi' | xargs -I '{}' \
8-
sh -c 'cat {} | ../bin/savi-lang-parse > {}.ast.yaml'
8+
sh -c 'cat {} | ../bin/savi-lang-parse --test-mode > {}.ast.yaml'
99

1010
git diff --exit-code savi-lang-parse

0 commit comments

Comments
 (0)