shen-ruby 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +8 -0
- data/README.md +7 -7
- data/k_lambda_spec/primitives/boolean_operations_spec.rb +1 -1
- data/lib/kl/compiler.rb +10 -5
- data/lib/kl/primitives/booleans.rb +4 -0
- data/lib/shen_ruby/version.rb +1 -1
- data/shen-ruby.gemspec +1 -1
- data/shen/release/k_lambda/declarations.kl +3 -3
- data/shen/release/k_lambda/macros.kl +43 -37
- data/shen/release/k_lambda/prolog.kl +97 -97
- data/shen/release/k_lambda/reader.kl +67 -67
- data/shen/release/k_lambda/sequent.kl +53 -53
- data/shen/release/k_lambda/sys.kl +106 -104
- data/shen/release/k_lambda/t-star.kl +50 -50
- data/shen/release/k_lambda/toplevel.kl +23 -23
- data/shen/release/k_lambda/track.kl +25 -25
- data/shen/release/k_lambda/types.kl +9 -7
- data/shen/release/k_lambda/writer.kl +22 -22
- data/shen/release/k_lambda/yacc.kl +32 -28
- metadata +3 -3
@@ -47,61 +47,65 @@
|
|
47
47
|
* explains this license in full. *
|
48
48
|
* *
|
49
49
|
*****************************************************************************************
|
50
|
-
"(defun shen.yacc (
|
50
|
+
"(defun shen.yacc (V2126) (cond ((and (cons? V2126) (and (= defcc (hd V2126)) (and (cons? (tl V2126)) (and (cons? (tl (tl V2126))) (and (= { (hd (tl (tl V2126)))) (and (cons? (tl (tl (tl V2126)))) (and (cons? (tl (tl (tl (tl V2126))))) (and (= ==> (hd (tl (tl (tl (tl V2126)))))) (and (cons? (tl (tl (tl (tl (tl V2126)))))) (and (cons? (tl (tl (tl (tl (tl (tl V2126))))))) (= } (hd (tl (tl (tl (tl (tl (tl V2126)))))))))))))))))) (shen.yacc (cons defcc (cons (hd (tl V2126)) (tl (tl (tl (tl (tl (tl (tl V2126))))))))))) ((and (cons? V2126) (and (= defcc (hd V2126)) (cons? (tl V2126)))) (shen.yacc->shen (hd (tl V2126)) (tl (tl V2126)))) (true (shen.sys-error shen.yacc))))
|
51
51
|
|
52
|
-
(defun shen.yacc->shen (
|
52
|
+
(defun shen.yacc->shen (V2127 V2128) (let CCRules (shen.split_cc_rules V2128 ()) (let CCBody (map shen.cc_body CCRules) (let YaccCases (shen.yacc_cases CCBody) (let CatchKill (shen.catchkill YaccCases) (cons define (cons V2127 (cons Stream (cons -> (cons CatchKill ()))))))))))
|
53
53
|
|
54
|
-
(defun shen.
|
54
|
+
(defun shen.split_cc_rules (V2129 V2130) (cond ((and (= () V2129) (= () V2130)) ()) ((= () V2129) (cons (shen.split_cc_rule (reverse V2130) ()) ())) ((and (cons? V2129) (= ; (hd V2129))) (cons (shen.split_cc_rule (reverse V2130) ()) (shen.split_cc_rules (tl V2129) ()))) ((cons? V2129) (shen.split_cc_rules (tl V2129) (cons (hd V2129) V2130))) (true (shen.sys-error shen.split_cc_rules))))
|
55
55
|
|
56
|
-
(defun shen.
|
56
|
+
(defun shen.split_cc_rule (V2131 V2132) (cond ((and (cons? V2131) (and (= := (hd V2131)) (and (cons? (tl V2131)) (= () (tl (tl V2131)))))) (cons (reverse V2132) (tl V2131))) ((and (cons? V2131) (and (= := (hd V2131)) (and (cons? (tl V2131)) (and (cons? (tl (tl V2131))) (and (= where (hd (tl (tl V2131)))) (and (cons? (tl (tl (tl V2131)))) (= () (tl (tl (tl (tl V2131))))))))))) (cons (reverse V2132) (cons (cons where (cons (hd (tl (tl (tl V2131)))) (cons (hd (tl V2131)) ()))) ()))) ((= () V2131) (do (shen.prhush "warning: " (stoutput)) (do (map (lambda X (shen.prhush (shen.app X " " shen.a) (stoutput))) (reverse V2132)) (do (shen.prhush "has no semantics.
|
57
|
+
" (stoutput)) (shen.split_cc_rule (cons := (cons (shen.default_semantics (reverse V2132)) ())) V2132))))) ((cons? V2131) (shen.split_cc_rule (tl V2131) (cons (hd V2131) V2132))) (true (shen.sys-error shen.split_cc_rule))))
|
57
58
|
|
58
|
-
(defun shen.
|
59
|
+
(defun shen.default_semantics (V2133) (cond ((= () V2133) ()) ((and (cons? V2133) (shen.grammar_symbol? (hd V2133))) (cons append (cons (hd V2133) (cons (shen.default_semantics (tl V2133)) ())))) ((cons? V2133) (cons cons (cons (hd V2133) (cons (shen.default_semantics (tl V2133)) ())))) (true (shen.sys-error shen.default_semantics))))
|
59
60
|
|
60
|
-
(defun shen.
|
61
|
-
" (stoutput)) (shen.split_cc_rule (cons := (cons (shen.default_semantics (reverse V2163)) ())) V2163))))) ((cons? V2162) (shen.split_cc_rule (tl V2162) (cons (hd V2162) V2163))) (true (shen.sys-error shen.split_cc_rule))))
|
61
|
+
(defun shen.grammar_symbol? (V2134) (and (symbol? V2134) (let Cs (shen.strip-pathname (explode V2134)) (and (= (hd Cs) "<") (= (hd (reverse Cs)) ">")))))
|
62
62
|
|
63
|
-
(defun shen.
|
63
|
+
(defun shen.yacc_cases (V2135) (cond ((and (cons? V2135) (= () (tl V2135))) (hd V2135)) ((cons? V2135) (let P YaccParse (cons let (cons P (cons (hd V2135) (cons (cons if (cons (cons = (cons P (cons (cons fail ()) ()))) (cons (shen.yacc_cases (tl V2135)) (cons P ())))) ())))))) (true (shen.sys-error shen.yacc_cases))))
|
64
64
|
|
65
|
-
(defun shen.cc_body (
|
65
|
+
(defun shen.cc_body (V2136) (cond ((and (cons? V2136) (and (cons? (tl V2136)) (= () (tl (tl V2136))))) (shen.syntax (hd V2136) Stream (hd (tl V2136)))) (true (shen.sys-error shen.cc_body))))
|
66
66
|
|
67
|
-
(defun shen.syntax (
|
67
|
+
(defun shen.syntax (V2137 V2138 V2139) (cond ((and (= () V2137) (and (cons? V2139) (and (= where (hd V2139)) (and (cons? (tl V2139)) (and (cons? (tl (tl V2139))) (= () (tl (tl (tl V2139))))))))) (cons if (cons (shen.semantics (hd (tl V2139))) (cons (cons shen.pair (cons (cons hd (cons V2138 ())) (cons (shen.semantics (hd (tl (tl V2139)))) ()))) (cons (cons fail ()) ()))))) ((= () V2137) (cons shen.pair (cons (cons hd (cons V2138 ())) (cons (shen.semantics V2139) ())))) ((cons? V2137) (if (shen.grammar_symbol? (hd V2137)) (shen.recursive_descent V2137 V2138 V2139) (if (variable? (hd V2137)) (shen.variable-match V2137 V2138 V2139) (if (shen.jump_stream? (hd V2137)) (shen.jump_stream V2137 V2138 V2139) (if (shen.terminal? (hd V2137)) (shen.check_stream V2137 V2138 V2139) (if (shen.list_stream? (hd V2137)) (shen.list_stream (shen.decons (hd V2137)) (tl V2137) V2138 V2139) (simple-error (shen.app (hd V2137) " is not legal syntax
|
68
68
|
" shen.a)))))))) (true (shen.sys-error shen.syntax))))
|
69
69
|
|
70
|
-
(defun shen.list_stream? (
|
70
|
+
(defun shen.list_stream? (V2148) (cond ((cons? V2148) true) (true false)))
|
71
71
|
|
72
|
-
(defun shen.decons (
|
72
|
+
(defun shen.decons (V2149) (cond ((and (cons? V2149) (and (= cons (hd V2149)) (and (cons? (tl V2149)) (and (cons? (tl (tl V2149))) (= () (tl (tl (tl V2149)))))))) (cons (hd (tl V2149)) (shen.decons (hd (tl (tl V2149)))))) (true V2149)))
|
73
73
|
|
74
|
-
(defun shen.list_stream (
|
74
|
+
(defun shen.list_stream (V2150 V2151 V2152 V2153) (let Test (cons and (cons (cons cons? (cons (cons hd (cons V2152 ())) ())) (cons (cons cons? (cons (cons hd (cons (cons hd (cons V2152 ())) ())) ())) ()))) (let Action (cons shen.snd-or-fail (cons (shen.syntax V2150 (cons shen.pair (cons (cons hd (cons (cons hd (cons V2152 ())) ())) (cons (cons shen.hdtl (cons V2152 ())) ()))) (cons shen.leave! (cons (shen.syntax V2151 (cons shen.pair (cons (cons tl (cons (cons hd (cons V2152 ())) ())) (cons (cons shen.hdtl (cons V2152 ())) ()))) V2153) ()))) ())) (let Else (cons fail ()) (cons if (cons Test (cons Action (cons Else ()))))))))
|
75
75
|
|
76
|
-
(defun shen.snd-or-fail (
|
76
|
+
(defun shen.snd-or-fail (V2160) (cond ((and (cons? V2160) (and (cons? (tl V2160)) (= () (tl (tl V2160))))) (hd (tl V2160))) (true (fail))))
|
77
77
|
|
78
|
-
(defun shen.
|
78
|
+
(defun shen.strip-pathname (V2165) (cond ((not (element? "." V2165)) V2165) ((cons? V2165) (shen.strip-pathname (tl V2165))) (true (shen.sys-error shen.strip-pathname))))
|
79
79
|
|
80
|
-
(defun shen.
|
80
|
+
(defun shen.recursive_descent (V2166 V2167 V2168) (cond ((cons? V2166) (let Test (cons (hd V2166) (cons V2167 ())) (let Action (shen.syntax (tl V2166) (concat Parse_ (hd V2166)) V2168) (let Else (cons fail ()) (cons let (cons (concat Parse_ (hd V2166)) (cons Test (cons (cons if (cons (cons not (cons (cons = (cons (cons fail ()) (cons (concat Parse_ (hd V2166)) ()))) ())) (cons Action (cons Else ())))) ())))))))) (true (shen.sys-error shen.recursive_descent))))
|
81
81
|
|
82
|
-
(defun shen.
|
82
|
+
(defun shen.variable-match (V2169 V2170 V2171) (cond ((cons? V2169) (let Test (cons cons? (cons (cons hd (cons V2170 ())) ())) (let Action (cons let (cons (concat Parse_ (hd V2169)) (cons (cons hd (cons (cons hd (cons V2170 ())) ())) (cons (shen.syntax (tl V2169) (cons shen.pair (cons (cons tl (cons (cons hd (cons V2170 ())) ())) (cons (cons shen.hdtl (cons V2170 ())) ()))) V2171) ())))) (let Else (cons fail ()) (cons if (cons Test (cons Action (cons Else ())))))))) (true (shen.sys-error shen.variable-match))))
|
83
83
|
|
84
|
-
(defun shen.
|
84
|
+
(defun shen.terminal? (V2180) (cond ((cons? V2180) false) ((variable? V2180) false) (true true)))
|
85
85
|
|
86
|
-
(defun shen.
|
86
|
+
(defun shen.jump_stream? (V2185) (cond ((= V2185 _) true) (true false)))
|
87
87
|
|
88
|
-
(defun shen.
|
88
|
+
(defun shen.check_stream (V2186 V2187 V2188) (cond ((cons? V2186) (let Test (cons and (cons (cons cons? (cons (cons hd (cons V2187 ())) ())) (cons (cons = (cons (hd V2186) (cons (cons hd (cons (cons hd (cons V2187 ())) ())) ()))) ()))) (let Action (shen.syntax (tl V2186) (cons shen.pair (cons (cons tl (cons (cons hd (cons V2187 ())) ())) (cons (cons shen.hdtl (cons V2187 ())) ()))) V2188) (let Else (cons fail ()) (cons if (cons Test (cons Action (cons Else ())))))))) (true (shen.sys-error shen.check_stream))))
|
89
89
|
|
90
|
-
(defun shen.
|
90
|
+
(defun shen.jump_stream (V2189 V2190 V2191) (cond ((cons? V2189) (let Test (cons cons? (cons (cons hd (cons V2190 ())) ())) (let Action (shen.syntax (tl V2189) (cons shen.pair (cons (cons tl (cons (cons hd (cons V2190 ())) ())) (cons (cons shen.hdtl (cons V2190 ())) ()))) V2191) (let Else (cons fail ()) (cons if (cons Test (cons Action (cons Else ())))))))) (true (shen.sys-error shen.jump_stream))))
|
91
91
|
|
92
|
-
(defun shen.
|
93
|
-
|
94
|
-
(defun shen.semantics (V2222) (cond ((and (cons? V2222) (and (= shen.leave! (hd V2222)) (and (cons? (tl V2222)) (= () (tl (tl V2222)))))) (hd (tl V2222))) ((= () V2222) ()) ((shen.grammar_symbol? V2222) (cons shen.hdtl (cons (concat Parse_ V2222) ()))) ((variable? V2222) (concat Parse_ V2222)) ((cons? V2222) (map shen.semantics V2222)) (true V2222)))
|
92
|
+
(defun shen.semantics (V2192) (cond ((and (cons? V2192) (and (= shen.leave! (hd V2192)) (and (cons? (tl V2192)) (= () (tl (tl V2192)))))) (hd (tl V2192))) ((= () V2192) ()) ((shen.grammar_symbol? V2192) (cons shen.hdtl (cons (concat Parse_ V2192) ()))) ((variable? V2192) (concat Parse_ V2192)) ((cons? V2192) (map shen.semantics V2192)) (true V2192)))
|
95
93
|
|
96
94
|
(defun fail () shen.fail!)
|
97
95
|
|
98
|
-
(defun shen.pair (
|
96
|
+
(defun shen.pair (V2193 V2194) (cons V2193 (cons V2194 ())))
|
97
|
+
|
98
|
+
(defun shen.hdtl (V2195) (hd (tl V2195)))
|
99
|
+
|
100
|
+
(defun <!> (V2202) (cond ((and (cons? V2202) (and (cons? (tl V2202)) (= () (tl (tl V2202))))) (cons () (cons (hd V2202) ()))) (true (fail))))
|
101
|
+
|
102
|
+
(defun <e> (V2207) (cond ((and (cons? V2207) (and (cons? (tl V2207)) (= () (tl (tl V2207))))) (cons (hd V2207) (cons () ()))) (true (shen.sys-error <e>))))
|
99
103
|
|
100
|
-
(defun shen.
|
104
|
+
(defun shen.catchkill (V2208) (cons trap-error (cons V2208 (cons (cons lambda (cons E (cons (cons shen.analyse-kill (cons E ())) ()))) ()))))
|
101
105
|
|
102
|
-
(defun
|
106
|
+
(defun shen.analyse-kill (V2209) (let String (error-to-string V2209) (if (= String "Shen YACC kill") (fail) (simple-error String))))
|
103
107
|
|
104
|
-
(defun
|
108
|
+
(defun kill () (simple-error "Shen YACC kill"))
|
105
109
|
|
106
110
|
|
107
111
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shen-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-06-11 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '2.12'
|
31
31
|
description: ShenRuby is a port of the Shen programming language to Ruby. It currently
|
32
|
-
supports Shen version
|
32
|
+
supports Shen version 12.
|
33
33
|
email:
|
34
34
|
- greg@sourcematters.org
|
35
35
|
executables:
|