Skip to content

Commit 7a6a67a

Browse files
authored
Upgrade to shen kernel 39.2 (#47)
* Add option to makefile shen-exe. * Update the minimum versio of go to 1.25 Remove unsafe warning * Update testing kl steps. * Update compilation step. * Create one file to run shen tets : runtests.shen * Update testing and compilation steps. * Remove go warnings * Upgrade to shen kernel 39.2 * Update the behaviour of open primitive
1 parent 72ea765 commit 7a6a67a

248 files changed

Lines changed: 95043 additions & 57130 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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
*.so
22
*.bc
3-
compiled
4-
shen
3+
shen
4+
*.exe

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ kl:
88
shen:
99
go build -o shen github.com/tiancaiamao/shen-go/cmd/shen
1010

11+
shen-exe:
12+
go build -o shen.exe github.com/tiancaiamao/shen-go/cmd/shen
13+
14+
15+
1116
docker:
1217
docker build -t shen-go .
1318
docker run -i -t --rm -v /tmp:/tmp shen-go \

README.md

Lines changed: 49 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ Make sure you have [Go installed](https://golang.org/doc/install).
2020
make shen
2121
```
2222

23+
or for windows
24+
25+
```
26+
make shen-exe
27+
```
28+
2329
## Running
2430

2531
```
@@ -40,23 +46,9 @@ make test
4046

4147
```
4248
make kl
43-
cd 'S31/Test Programs'
49+
cd 'S39/Test Programs'
4450
kl
45-
(load-file "../KLambda/toplevel.kl")
46-
(load-file "../KLambda/core.kl")
47-
(load-file "../KLambda/sys.kl")
48-
(load-file "../KLambda/sequent.kl")
49-
(load-file "../KLambda/yacc.kl")
50-
(load-file "../KLambda/reader.kl")
51-
(load-file "../KLambda/prolog.kl")
52-
(load-file "../KLambda/track.kl")
53-
(load-file "../KLambda/load.kl")
54-
(load-file "../KLambda/writer.kl")
55-
(load-file "../KLambda/macros.kl")
56-
(load-file "../KLambda/declarations.kl")
57-
(load-file "../KLambda/t-star.kl")
58-
(load-file "../KLambda/types.kl")
59-
(shen.shen)
51+
(load-file "../../cmd/kl/runtests.kl")
6052
(load "runme.shen")
6153
```
6254

@@ -65,33 +57,45 @@ kl
6557

6658
```
6759
make shen
68-
cd 'S31/Test Programs'
60+
cd 'S39/Test Programs'
6961
../../shen
7062
(load "runme.shen")
7163
```
7264

7365
## How to bootstrap
7466

67+
You can just do
68+
```
69+
cd compiled
70+
kl
71+
(load-file "script.kl")
72+
(load "compile-to-go.shen")
73+
(load "bctogo.shen")
74+
cd ..
75+
make shen
76+
```
77+
Explanation :
78+
7579
`kl` implement a simple klambda interpreter in Go, which can be used to bootstrap `shen`
7680

7781
```
7882
;; mkdir -p compiled
7983
;; cd compiled
8084
;; kl
81-
(load-file "../S31/KLambda/toplevel.kl")
82-
(load-file "../S31/KLambda/core.kl")
83-
(load-file "../S31/KLambda/sys.kl")
84-
(load-file "../S31/KLambda/sequent.kl")
85-
(load-file "../S31/KLambda/yacc.kl")
86-
(load-file "../S31/KLambda/reader.kl")
87-
(load-file "../S31/KLambda/prolog.kl")
88-
(load-file "../S31/KLambda/track.kl")
89-
(load-file "../S31/KLambda/load.kl")
90-
(load-file "../S31/KLambda/writer.kl")
91-
(load-file "../S31/KLambda/macros.kl")
92-
(load-file "../S31/KLambda/declarations.kl")
93-
(load-file "../S31/KLambda/t-star.kl")
94-
(load-file "../S31/KLambda/types.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")
9599
(shen.shen)
96100
```
97101

@@ -107,20 +111,20 @@ Compile the klambda to the intermediate representation:
107111

108112
```
109113
(set *maximum-print-sequence-size* 100000)
110-
(compile-file "../S31/KLambda/sys.kl" "sys.tmp")
111-
(compile-file "../S31/KLambda/writer.kl" "writer.tmp")
112-
(compile-file "../S31/KLambda/core.kl" "core.tmp")
113-
(compile-file "../S31/KLambda/reader.kl" "reader.tmp")
114-
(compile-file "../S31/KLambda/declarations.kl" "declarations.tmp")
115-
(compile-file "../S31/KLambda/toplevel.kl" "toplevel.tmp")
116-
(compile-file "../S31/KLambda/macros.kl" "macros.tmp")
117-
(compile-file "../S31/KLambda/load.kl" "load.tmp")
118-
(compile-file "../S31/KLambda/prolog.kl" "prolog.tmp")
119-
(compile-file "../S31/KLambda/sequent.kl" "sequent.tmp")
120-
(compile-file "../S31/KLambda/track.kl" "track.tmp")
121-
(compile-file "../S31/KLambda/t-star.kl" "t-star.tmp")
122-
(compile-file "../S31/KLambda/yacc.kl" "yacc.tmp")
123-
(compile-file "../S31/KLambda/types.kl" "types.tmp")
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")
124128
```
125129

126130
And generate the Go files from the intermediate representation:

S31/KLambda/backend.kl

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

0 commit comments

Comments
 (0)