Skip to content

Commit 343d665

Browse files
pyrex41Reuben Brooks
andauthored
Upgrade to shen kernel 41.1 (#51)
Refresh the bundled Shen sources and generated Go kernel so the port starts from the 41.1 initialise/repl entry points. Made-with: Cursor Co-authored-by: Reuben Brooks <reuben.brooks@facilitygrid.com>
1 parent a52bdc8 commit 343d665

295 files changed

Lines changed: 90482 additions & 87540 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
*.so
22
*.bc
3-
shen
3+
/shen
44
*.exe

README.md

Lines changed: 36 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ make test
4646

4747
```
4848
make kl
49-
cd 'S39/Test Programs'
49+
cd kernel/tests
5050
kl
5151
(load-file "../../cmd/kl/runtests.kl")
5252
(load "runme.shen")
@@ -57,7 +57,7 @@ kl
5757

5858
```
5959
make shen
60-
cd 'S39/Test Programs'
60+
cd kernel/tests
6161
../../shen
6262
(load "runme.shen")
6363
```
@@ -69,8 +69,6 @@ You can just do
6969
cd compiled
7070
kl
7171
(load-file "script.kl")
72-
(load "compile-to-go.shen")
73-
(load "bctogo.shen")
7472
cd ..
7573
make shen
7674
```
@@ -79,24 +77,23 @@ Explanation :
7977
`kl` implement a simple klambda interpreter in Go, which can be used to bootstrap `shen`
8078

8179
```
82-
;; mkdir -p compiled
83-
;; cd compiled
84-
;; kl
85-
(load-file "../S39/KLambda/toplevel.kl")
86-
(load-file "../S39/KLambda/core.kl")
87-
(load-file "../S39/KLambda/sys.kl")
88-
(load-file "../S39/KLambda/sequent.kl")
89-
(load-file "../S39/KLambda/yacc.kl")
90-
(load-file "../S39/KLambda/reader.kl")
91-
(load-file "../S39/KLambda/prolog.kl")
92-
(load-file "../S39/KLambda/track.kl")
93-
(load-file "../S39/KLambda/load.kl")
94-
(load-file "../S39/KLambda/writer.kl")
95-
(load-file "../S39/KLambda/macros.kl")
96-
(load-file "../S39/KLambda/declarations.kl")
97-
(load-file "../S39/KLambda/t-star.kl")
98-
(load-file "../S39/KLambda/types.kl")
99-
(shen.shen)
80+
(load-file "../kernel/klambda/toplevel.kl")
81+
(load-file "../kernel/klambda/core.kl")
82+
(load-file "../kernel/klambda/sys.kl")
83+
(load-file "../kernel/klambda/sequent.kl")
84+
(load-file "../kernel/klambda/yacc.kl")
85+
(load-file "../kernel/klambda/reader.kl")
86+
(load-file "../kernel/klambda/prolog.kl")
87+
(load-file "../kernel/klambda/track.kl")
88+
(load-file "../kernel/klambda/load.kl")
89+
(load-file "../kernel/klambda/writer.kl")
90+
(load-file "../kernel/klambda/macros.kl")
91+
(load-file "../kernel/klambda/declarations.kl")
92+
(load-file "../kernel/klambda/t-star.kl")
93+
(load-file "../kernel/klambda/types.kl")
94+
(load-file "../kernel/klambda/dict.kl")
95+
(load-file "../kernel/klambda/init.kl")
96+
(shen.initialise)
10097
```
10198

10299
`shen` source files is generated from the `.kl` files. The full transformation path is Shen -> KL -> IR -> Go.
@@ -111,43 +108,27 @@ Compile the klambda to the intermediate representation:
111108

112109
```
113110
(set *maximum-print-sequence-size* 100000)
114-
(compile-file "../S39/KLambda/sys.kl" "sys.tmp")
115-
(compile-file "../S39/KLambda/writer.kl" "writer.tmp")
116-
(compile-file "../S39/KLambda/core.kl" "core.tmp")
117-
(compile-file "../S39/KLambda/reader.kl" "reader.tmp")
118-
(compile-file "../S39/KLambda/declarations.kl" "declarations.tmp")
119-
(compile-file "../S39/KLambda/toplevel.kl" "toplevel.tmp")
120-
(compile-file "../S39/KLambda/macros.kl" "macros.tmp")
121-
(compile-file "../S39/KLambda/load.kl" "load.tmp")
122-
(compile-file "../S39/KLambda/prolog.kl" "prolog.tmp")
123-
(compile-file "../S39/KLambda/sequent.kl" "sequent.tmp")
124-
(compile-file "../S39/KLambda/track.kl" "track.tmp")
125-
(compile-file "../S39/KLambda/t-star.kl" "t-star.tmp")
126-
(compile-file "../S39/KLambda/yacc.kl" "yacc.tmp")
127-
(compile-file "../S39/KLambda/types.kl" "types.tmp")
111+
(compile-file "../kernel/klambda/sys.kl" "sys.tmp")
112+
(compile-file "../kernel/klambda/writer.kl" "writer.tmp")
113+
(compile-file "../kernel/klambda/core.kl" "core.tmp")
114+
(compile-file "../kernel/klambda/reader.kl" "reader.tmp")
115+
(compile-file "../kernel/klambda/declarations.kl" "declarations.tmp")
116+
(compile-file "../kernel/klambda/toplevel.kl" "toplevel.tmp")
117+
(compile-file "../kernel/klambda/macros.kl" "macros.tmp")
118+
(compile-file "../kernel/klambda/load.kl" "load.tmp")
119+
(compile-file "../kernel/klambda/prolog.kl" "prolog.tmp")
120+
(compile-file "../kernel/klambda/sequent.kl" "sequent.tmp")
121+
(compile-file "../kernel/klambda/track.kl" "track.tmp")
122+
(compile-file "../kernel/klambda/t-star.kl" "t-star.tmp")
123+
(compile-file "../kernel/klambda/yacc.kl" "yacc.tmp")
124+
(compile-file "../kernel/klambda/types.kl" "types.tmp")
125+
(compile-file "../kernel/klambda/dict.kl" "dict.tmp")
126+
(compile-file "../kernel/klambda/init.kl" "init.tmp")
128127
```
129128

130129
And generate the Go files from the intermediate representation:
131130

132-
```
133-
(put bc->go arity 5)
134-
(let Cg (make-code-generator)
135-
(do
136-
(bc->go Cg "SysMain" false "sys.tmp" "../cmd/shen/sys.go")
137-
(bc->go Cg "WriterMain" false "writer.tmp" "../cmd/shen/writer.go")
138-
(bc->go Cg "CoreMain" false "core.tmp" "../cmd/shen/core.go")
139-
(bc->go Cg "ReaderMain" false "reader.tmp" "../cmd/shen/reader.go")
140-
(bc->go Cg "DeclarationsMain" false "declarations.tmp" "../cmd/shen/declarations.go")
141-
(bc->go Cg "TopLevelMain" false "toplevel.tmp" "../cmd/shen/toplevel.go")
142-
(bc->go Cg "MacrosMain" false "macros.tmp" "../cmd/shen/macros.go")
143-
(bc->go Cg "LoadMain" false "load.tmp" "../cmd/shen/load.go")
144-
(bc->go Cg "PrologMain" false "prolog.tmp" "../cmd/shen/prolog.go")
145-
(bc->go Cg "SequentMain" false "sequent.tmp" "../cmd/shen/sequent.go")
146-
(bc->go Cg "TrackMain" false "track.tmp" "../cmd/shen/track.go")
147-
(bc->go Cg "TStarMain" false "t-star.tmp" "../cmd/shen/t-star.go")
148-
(bc->go Cg "YaccMain" false "yacc.tmp" "../cmd/shen/yacc.go")
149-
(bc->go Cg "TypesMain" true "types.tmp" "../cmd/shen/types.go")))
150-
```
131+
Use `compiled/bctogo.shen` to generate the Go files from the intermediate representation.
151132

152133
Now the shen source files are available, built it:
153134

S39/KLambda/backend.kl

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)