shen-ruby 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/HISTORY.md +8 -0
- data/MIT_LICENSE.txt +1 -1
- data/README.md +4 -3
- data/lib/kl/primitives/vectors.rb +1 -0
- data/lib/shen_ruby/version.rb +1 -1
- data/shen-ruby.gemspec +1 -1
- data/shen/release/k_lambda/core.kl +67 -59
- data/shen/release/k_lambda/declarations.kl +13 -9
- data/shen/release/k_lambda/load.kl +17 -15
- data/shen/release/k_lambda/macros.kl +33 -31
- data/shen/release/k_lambda/prolog.kl +97 -97
- data/shen/release/k_lambda/reader.kl +71 -63
- data/shen/release/k_lambda/sequent.kl +55 -51
- data/shen/release/k_lambda/sys.kl +107 -102
- data/shen/release/k_lambda/t-star.kl +51 -55
- data/shen/release/k_lambda/toplevel.kl +30 -29
- data/shen/release/k_lambda/track.kl +25 -25
- data/shen/release/k_lambda/types.kl +10 -6
- data/shen/release/k_lambda/writer.kl +24 -20
- data/shen/release/k_lambda/yacc.kl +28 -26
- metadata +3 -3
@@ -47,59 +47,61 @@
|
|
47
47
|
* explains this license in full. *
|
48
48
|
* *
|
49
49
|
*****************************************************************************************
|
50
|
-
"(defun shen.yacc (
|
50
|
+
"(defun shen.yacc (V2150) (cond ((and (cons? V2150) (and (= defcc (hd V2150)) (and (cons? (tl V2150)) (and (cons? (tl (tl V2150))) (and (= { (hd (tl (tl V2150)))) (and (cons? (tl (tl (tl V2150)))) (and (cons? (tl (tl (tl (tl V2150))))) (and (= ==> (hd (tl (tl (tl (tl V2150)))))) (and (cons? (tl (tl (tl (tl (tl V2150)))))) (and (cons? (tl (tl (tl (tl (tl (tl V2150))))))) (= } (hd (tl (tl (tl (tl (tl (tl V2150)))))))))))))))))) (shen.yacc (cons defcc (cons (hd (tl V2150)) (tl (tl (tl (tl (tl (tl (tl V2150))))))))))) ((and (cons? V2150) (and (= defcc (hd V2150)) (cons? (tl V2150)))) (shen.yacc->shen (hd (tl V2150)) (tl (tl V2150)))) (true (shen.sys-error shen.yacc))))
|
51
51
|
|
52
|
-
(defun shen.yacc->shen (
|
52
|
+
(defun shen.yacc->shen (V2151 V2152) (cons define (cons V2151 (shen.yacc_cases (map shen.cc_body (shen.split_cc_rules V2152 ()))))))
|
53
53
|
|
54
|
-
(defun shen.yacc_cases (
|
54
|
+
(defun shen.yacc_cases (V2153) (append (mapcan (lambda Case (cons Stream (cons <- (cons Case ())))) V2153) (cons _ (cons -> (cons (cons fail ()) ())))))
|
55
55
|
|
56
|
-
(defun shen.first_n (
|
56
|
+
(defun shen.first_n (V2158 V2159) (cond ((= 0 V2158) ()) ((= () V2159) ()) ((cons? V2159) (cons (hd V2159) (shen.first_n (- V2158 1) (tl V2159)))) (true (shen.sys-error shen.first_n))))
|
57
57
|
|
58
|
-
(defun shen.split_cc_rules (
|
58
|
+
(defun shen.split_cc_rules (V2160 V2161) (cond ((and (= () V2160) (= () V2161)) ()) ((= () V2160) (cons (shen.split_cc_rule (reverse V2161) ()) ())) ((and (cons? V2160) (= ; (hd V2160))) (cons (shen.split_cc_rule (reverse V2161) ()) (shen.split_cc_rules (tl V2160) ()))) ((cons? V2160) (shen.split_cc_rules (tl V2160) (cons (hd V2160) V2161))) (true (shen.sys-error shen.split_cc_rules))))
|
59
59
|
|
60
|
-
(defun shen.split_cc_rule (
|
61
|
-
" (stoutput)) (shen.split_cc_rule (cons := (cons (shen.default_semantics (reverse
|
60
|
+
(defun shen.split_cc_rule (V2162 V2163) (cond ((and (cons? V2162) (and (= := (hd V2162)) (and (cons? (tl V2162)) (= () (tl (tl V2162)))))) (cons (reverse V2163) (tl V2162))) ((and (cons? V2162) (and (= := (hd V2162)) (and (cons? (tl V2162)) (and (cons? (tl (tl V2162))) (and (= where (hd (tl (tl V2162)))) (and (cons? (tl (tl (tl V2162)))) (= () (tl (tl (tl (tl V2162))))))))))) (cons (reverse V2163) (cons (cons where (cons (hd (tl (tl (tl V2162)))) (cons (hd (tl V2162)) ()))) ()))) ((= () V2162) (do (shen.prhush "warning: " (stoutput)) (do (map (lambda X (shen.prhush (shen.app X " " shen.a) (stoutput))) (reverse V2163)) (do (shen.prhush "has no semantics.
|
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))))
|
62
62
|
|
63
|
-
(defun shen.default_semantics (
|
63
|
+
(defun shen.default_semantics (V2164) (cond ((= () V2164) ()) ((and (cons? V2164) (shen.grammar_symbol? (hd V2164))) (cons append (cons (hd V2164) (cons (shen.default_semantics (tl V2164)) ())))) ((cons? V2164) (cons cons (cons (hd V2164) (cons (shen.default_semantics (tl V2164)) ())))) (true (shen.sys-error shen.default_semantics))))
|
64
64
|
|
65
|
-
(defun shen.cc_body (
|
65
|
+
(defun shen.cc_body (V2165) (cond ((and (cons? V2165) (and (cons? (tl V2165)) (= () (tl (tl V2165))))) (shen.syntax (hd V2165) Stream (hd (tl V2165)))) (true (shen.sys-error shen.cc_body))))
|
66
66
|
|
67
|
-
(defun shen.syntax (
|
67
|
+
(defun shen.syntax (V2166 V2167 V2168) (cond ((and (= () V2166) (and (cons? V2168) (and (= where (hd V2168)) (and (cons? (tl V2168)) (and (cons? (tl (tl V2168))) (= () (tl (tl (tl V2168))))))))) (cons if (cons (shen.semantics (hd (tl V2168))) (cons (cons shen.pair (cons (cons hd (cons V2167 ())) (cons (shen.semantics (hd (tl (tl V2168)))) ()))) (cons (cons fail ()) ()))))) ((= () V2166) (cons shen.pair (cons (cons hd (cons V2167 ())) (cons (shen.semantics V2168) ())))) ((cons? V2166) (if (shen.grammar_symbol? (hd V2166)) (shen.recursive_descent V2166 V2167 V2168) (if (variable? (hd V2166)) (shen.variable-match V2166 V2167 V2168) (if (shen.terminal? (hd V2166)) (shen.check_stream V2166 V2167 V2168) (if (shen.jump_stream? (hd V2166)) (shen.jump_stream V2166 V2167 V2168) (if (shen.list_stream? (hd V2166)) (shen.list_stream (shen.decons (hd V2166)) (tl V2166) V2167 V2168) (simple-error (shen.app (hd V2166) " 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? (V2177) (cond ((cons? V2177) true) (true false)))
|
71
71
|
|
72
|
-
(defun shen.decons (
|
72
|
+
(defun shen.decons (V2178) (cond ((and (cons? V2178) (and (= cons (hd V2178)) (and (cons? (tl V2178)) (and (cons? (tl (tl V2178))) (= () (tl (tl (tl V2178)))))))) (cons (hd (tl V2178)) (shen.decons (hd (tl (tl V2178)))))) (true V2178)))
|
73
73
|
|
74
|
-
(defun shen.list_stream (
|
74
|
+
(defun shen.list_stream (V2179 V2180 V2181 V2182) (let Test (cons and (cons (cons cons? (cons (cons hd (cons V2181 ())) ())) (cons (cons cons? (cons (cons hd (cons (cons hd (cons V2181 ())) ())) ())) ()))) (let Action (cons shen.snd-or-fail (cons (shen.syntax V2179 (cons shen.pair (cons (cons hd (cons (cons hd (cons V2181 ())) ())) (cons (cons shen.hdtl (cons V2181 ())) ()))) (cons shen.leave! (cons (shen.syntax V2180 (cons shen.pair (cons (cons tl (cons (cons hd (cons V2181 ())) ())) (cons (cons shen.hdtl (cons V2181 ())) ()))) V2182) ()))) ())) (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 (V2189) (cond ((and (cons? V2189) (and (cons? (tl V2189)) (= () (tl (tl V2189))))) (hd (tl V2189))) (true (fail))))
|
77
77
|
|
78
|
-
(defun shen.grammar_symbol? (
|
78
|
+
(defun shen.grammar_symbol? (V2190) (and (symbol? V2190) (let Cs (shen.strip-pathname (explode V2190)) (and (= (hd Cs) "<") (= (hd (reverse Cs)) ">")))))
|
79
79
|
|
80
|
-
(defun shen.
|
80
|
+
(defun shen.strip-pathname (V2195) (cond ((not (element? "." V2195)) V2195) ((cons? V2195) (shen.strip-pathname (tl V2195))) (true (shen.sys-error shen.strip-pathname))))
|
81
81
|
|
82
|
-
(defun shen.
|
82
|
+
(defun shen.recursive_descent (V2196 V2197 V2198) (cond ((cons? V2196) (let Test (cons (hd V2196) (cons V2197 ())) (let Action (shen.syntax (tl V2196) (concat Parse_ (hd V2196)) V2198) (let Else (cons fail ()) (cons let (cons (concat Parse_ (hd V2196)) (cons Test (cons (cons if (cons (cons not (cons (cons = (cons (cons fail ()) (cons (concat Parse_ (hd V2196)) ()))) ())) (cons Action (cons Else ())))) ())))))))) (true (shen.sys-error shen.recursive_descent))))
|
83
83
|
|
84
|
-
(defun shen.
|
84
|
+
(defun shen.variable-match (V2199 V2200 V2201) (cond ((cons? V2199) (let Test (cons cons? (cons (cons hd (cons V2200 ())) ())) (let Action (cons let (cons (concat Parse_ (hd V2199)) (cons (cons hd (cons (cons hd (cons V2200 ())) ())) (cons (shen.syntax (tl V2199) (cons shen.pair (cons (cons tl (cons (cons hd (cons V2200 ())) ())) (cons (cons shen.hdtl (cons V2200 ())) ()))) V2201) ())))) (let Else (cons fail ()) (cons if (cons Test (cons Action (cons Else ())))))))) (true (shen.sys-error shen.variable-match))))
|
85
85
|
|
86
|
-
(defun shen.
|
86
|
+
(defun shen.terminal? (V2210) (cond ((cons? V2210) false) ((variable? V2210) false) (true true)))
|
87
87
|
|
88
|
-
(defun shen.
|
88
|
+
(defun shen.jump_stream? (V2215) (cond ((= V2215 _) true) (true false)))
|
89
89
|
|
90
|
-
(defun shen.
|
90
|
+
(defun shen.check_stream (V2216 V2217 V2218) (cond ((cons? V2216) (let Test (cons and (cons (cons cons? (cons (cons hd (cons V2217 ())) ())) (cons (cons = (cons (hd V2216) (cons (cons hd (cons (cons hd (cons V2217 ())) ())) ()))) ()))) (let Action (shen.syntax (tl V2216) (cons shen.pair (cons (cons tl (cons (cons hd (cons V2217 ())) ())) (cons (cons shen.hdtl (cons V2217 ())) ()))) V2218) (let Else (cons fail ()) (cons if (cons Test (cons Action (cons Else ())))))))) (true (shen.sys-error shen.check_stream))))
|
91
91
|
|
92
|
-
(defun shen.
|
92
|
+
(defun shen.jump_stream (V2219 V2220 V2221) (cond ((cons? V2219) (let Test (cons cons? (cons (cons hd (cons V2220 ())) ())) (let Action (shen.syntax (tl V2219) (cons shen.pair (cons (cons tl (cons (cons hd (cons V2220 ())) ())) (cons (cons shen.hdtl (cons V2220 ())) ()))) V2221) (let Else (cons fail ()) (cons if (cons Test (cons Action (cons Else ())))))))) (true (shen.sys-error shen.jump_stream))))
|
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)))
|
93
95
|
|
94
96
|
(defun fail () shen.fail!)
|
95
97
|
|
96
|
-
(defun shen.pair (
|
98
|
+
(defun shen.pair (V2223 V2224) (cons V2223 (cons V2224 ())))
|
97
99
|
|
98
|
-
(defun shen.hdtl (
|
100
|
+
(defun shen.hdtl (V2225) (hd (tl V2225)))
|
99
101
|
|
100
|
-
(defun <!> (
|
102
|
+
(defun <!> (V2232) (cond ((and (cons? V2232) (and (cons? (tl V2232)) (= () (tl (tl V2232))))) (cons () (cons (hd V2232) ()))) (true (fail))))
|
101
103
|
|
102
|
-
(defun <e> (
|
104
|
+
(defun <e> (V2237) (cond ((and (cons? V2237) (and (cons? (tl V2237)) (= () (tl (tl V2237))))) (cons (hd V2237) (cons () ()))) (true (shen.sys-error <e>))))
|
103
105
|
|
104
106
|
|
105
107
|
|
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.5.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-05-13 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 11.
|
33
33
|
email:
|
34
34
|
- greg@sourcematters.org
|
35
35
|
executables:
|