shen-ruby 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.travis.yml +1 -1
- data/HISTORY.md +4 -0
- data/README.md +7 -7
- data/lib/shen_ruby/version.rb +1 -1
- data/shen/release/k_lambda/declarations.kl +4 -53
- data/shen/release/k_lambda/macros.kl +1 -1
- data/shen/release/k_lambda/t-star.kl +61 -50
- data/shen/release/k_lambda/toplevel.kl +21 -21
- data/shen/release/k_lambda/types.kl +1 -5
- data/shen/release/k_lambda/writer.kl +25 -25
- data/shen/release/k_lambda/yacc.kl +28 -26
- data/shen-ruby.gemspec +1 -1
- metadata +8 -12
@@ -61,27 +61,27 @@ port " (shen.app (value *port*) (cn " ported by " (shen.app (value *porters*) "
|
|
61
61
|
|
62
62
|
(defun shen.initialise_environment () (shen.multiple-set (cons shen.*call* (cons 0 (cons shen.*infs* (cons 0 (cons shen.*process-counter* (cons 0 (cons shen.*catch* (cons 0 ()))))))))))
|
63
63
|
|
64
|
-
(defun shen.multiple-set (
|
64
|
+
(defun shen.multiple-set (V2316) (cond ((= () V2316) ()) ((and (cons? V2316) (cons? (tl V2316))) (do (set (hd V2316) (hd (tl V2316))) (shen.multiple-set (tl (tl V2316))))) (true (shen.sys-error shen.multiple-set))))
|
65
65
|
|
66
|
-
(defun destroy (
|
66
|
+
(defun destroy (V2317) (declare V2317 symbol))
|
67
67
|
|
68
68
|
(set shen.*history* ())
|
69
69
|
|
70
70
|
(defun shen.read-evaluate-print () (let Lineread (shen.toplineread) (let History (value shen.*history*) (let NewLineread (shen.retrieve-from-history-if-needed Lineread History) (let NewHistory (shen.update_history NewLineread History) (let Parsed (fst NewLineread) (shen.toplevel Parsed)))))))
|
71
71
|
|
72
|
-
(defun shen.retrieve-from-history-if-needed (
|
72
|
+
(defun shen.retrieve-from-history-if-needed (V2327 V2328) (cond ((and (tuple? V2327) (and (cons? (snd V2327)) (element? (hd (snd V2327)) (cons (shen.space) (cons (shen.newline) ()))))) (shen.retrieve-from-history-if-needed (@p (fst V2327) (tl (snd V2327))) V2328)) ((and (tuple? V2327) (and (cons? (snd V2327)) (and (cons? (tl (snd V2327))) (and (= () (tl (tl (snd V2327)))) (and (cons? V2328) (and (= (hd (snd V2327)) (shen.exclamation)) (= (hd (tl (snd V2327))) (shen.exclamation)))))))) (let PastPrint (shen.prbytes (snd (hd V2328))) (hd V2328))) ((and (tuple? V2327) (and (cons? (snd V2327)) (= (hd (snd V2327)) (shen.exclamation)))) (let Key? (shen.make-key (tl (snd V2327)) V2328) (let Find (head (shen.find-past-inputs Key? V2328)) (let PastPrint (shen.prbytes (snd Find)) Find)))) ((and (tuple? V2327) (and (cons? (snd V2327)) (and (= () (tl (snd V2327))) (= (hd (snd V2327)) (shen.percent))))) (do (shen.print-past-inputs (lambda X true) (reverse V2328) 0) (abort))) ((and (tuple? V2327) (and (cons? (snd V2327)) (= (hd (snd V2327)) (shen.percent)))) (let Key? (shen.make-key (tl (snd V2327)) V2328) (let Pastprint (shen.print-past-inputs Key? (reverse V2328) 0) (abort)))) (true V2327)))
|
73
73
|
|
74
74
|
(defun shen.percent () 37)
|
75
75
|
|
76
76
|
(defun shen.exclamation () 33)
|
77
77
|
|
78
|
-
(defun shen.prbytes (
|
78
|
+
(defun shen.prbytes (V2329) (do (map (lambda Byte (pr (n->string Byte) (stoutput))) V2329) (nl 1)))
|
79
79
|
|
80
|
-
(defun shen.update_history (
|
80
|
+
(defun shen.update_history (V2330 V2331) (set shen.*history* (cons V2330 V2331)))
|
81
81
|
|
82
82
|
(defun shen.toplineread () (shen.toplineread_loop (read-byte (stinput)) ()))
|
83
83
|
|
84
|
-
(defun shen.toplineread_loop (
|
84
|
+
(defun shen.toplineread_loop (V2333 V2334) (cond ((= V2333 (shen.hat)) (simple-error "line read aborted")) ((element? V2333 (cons (shen.newline) (cons (shen.carriage-return) ()))) (let Line (compile shen.<st_input> V2334 (lambda E shen.nextline)) (if (or (= Line shen.nextline) (empty? Line)) (shen.toplineread_loop (read-byte (stinput)) (append V2334 (cons V2333 ()))) (@p Line V2334)))) (true (shen.toplineread_loop (read-byte (stinput)) (append V2334 (cons V2333 ()))))))
|
85
85
|
|
86
86
|
(defun shen.hat () 94)
|
87
87
|
|
@@ -89,7 +89,7 @@ port " (shen.app (value *port*) (cn " ported by " (shen.app (value *porters*) "
|
|
89
89
|
|
90
90
|
(defun shen.carriage-return () 13)
|
91
91
|
|
92
|
-
(defun tc (
|
92
|
+
(defun tc (V2339) (cond ((= + V2339) (set shen.*tc* true)) ((= - V2339) (set shen.*tc* false)) (true (simple-error "tc expects a + or -"))))
|
93
93
|
|
94
94
|
(defun shen.prompt () (if (value shen.*tc*) (shen.prhush (cn "
|
95
95
|
|
@@ -97,16 +97,16 @@ port " (shen.app (value *port*) (cn " ported by " (shen.app (value *porters*) "
|
|
97
97
|
|
98
98
|
(" (shen.app (length (value shen.*history*)) "-) " shen.a)) (stoutput))))
|
99
99
|
|
100
|
-
(defun shen.toplevel (
|
100
|
+
(defun shen.toplevel (V2340) (shen.toplevel_evaluate V2340 (value shen.*tc*)))
|
101
101
|
|
102
|
-
(defun shen.find-past-inputs (
|
102
|
+
(defun shen.find-past-inputs (V2341 V2342) (let F (shen.find V2341 V2342) (if (empty? F) (simple-error "input not found
|
103
103
|
") F)))
|
104
104
|
|
105
|
-
(defun shen.make-key (
|
105
|
+
(defun shen.make-key (V2343 V2344) (let Atom (hd (compile shen.<st_input> V2343 (lambda E (if (cons? E) (simple-error (cn "parse error here: " (shen.app E "
|
106
106
|
" shen.s))) (simple-error "parse error
|
107
|
-
"))))) (if (integer? Atom) (lambda X (= X (nth (+ Atom 1) (reverse
|
107
|
+
"))))) (if (integer? Atom) (lambda X (= X (nth (+ Atom 1) (reverse V2344)))) (lambda X (shen.prefix? V2343 (shen.trim-gubbins (snd X)))))))
|
108
108
|
|
109
|
-
(defun shen.trim-gubbins (
|
109
|
+
(defun shen.trim-gubbins (V2345) (cond ((and (cons? V2345) (= (hd V2345) (shen.space))) (shen.trim-gubbins (tl V2345))) ((and (cons? V2345) (= (hd V2345) (shen.newline))) (shen.trim-gubbins (tl V2345))) ((and (cons? V2345) (= (hd V2345) (shen.carriage-return))) (shen.trim-gubbins (tl V2345))) ((and (cons? V2345) (= (hd V2345) (shen.tab))) (shen.trim-gubbins (tl V2345))) ((and (cons? V2345) (= (hd V2345) (shen.left-round))) (shen.trim-gubbins (tl V2345))) (true V2345)))
|
110
110
|
|
111
111
|
(defun shen.space () 32)
|
112
112
|
|
@@ -114,22 +114,22 @@ port " (shen.app (value *port*) (cn " ported by " (shen.app (value *porters*) "
|
|
114
114
|
|
115
115
|
(defun shen.left-round () 40)
|
116
116
|
|
117
|
-
(defun shen.find (
|
117
|
+
(defun shen.find (V2352 V2353) (cond ((= () V2353) ()) ((and (cons? V2353) (V2352 (hd V2353))) (cons (hd V2353) (shen.find V2352 (tl V2353)))) ((cons? V2353) (shen.find V2352 (tl V2353))) (true (shen.sys-error shen.find))))
|
118
118
|
|
119
|
-
(defun shen.prefix? (
|
119
|
+
(defun shen.prefix? (V2364 V2365) (cond ((= () V2364) true) ((and (cons? V2364) (and (cons? V2365) (= (hd V2365) (hd V2364)))) (shen.prefix? (tl V2364) (tl V2365))) (true false)))
|
120
120
|
|
121
|
-
(defun shen.print-past-inputs (
|
121
|
+
(defun shen.print-past-inputs (V2375 V2376 V2377) (cond ((= () V2376) _) ((and (cons? V2376) (not (V2375 (hd V2376)))) (shen.print-past-inputs V2375 (tl V2376) (+ V2377 1))) ((and (cons? V2376) (tuple? (hd V2376))) (do (shen.prhush (shen.app V2377 ". " shen.a) (stoutput)) (do (shen.prbytes (snd (hd V2376))) (shen.print-past-inputs V2375 (tl V2376) (+ V2377 1))))) (true (shen.sys-error shen.print-past-inputs))))
|
122
122
|
|
123
|
-
(defun shen.toplevel_evaluate (
|
123
|
+
(defun shen.toplevel_evaluate (V2378 V2379) (cond ((and (cons? V2378) (and (cons? (tl V2378)) (and (= : (hd (tl V2378))) (and (cons? (tl (tl V2378))) (and (= () (tl (tl (tl V2378)))) (= true V2379)))))) (shen.typecheck-and-evaluate (hd V2378) (hd (tl (tl V2378))))) ((and (cons? V2378) (cons? (tl V2378))) (do (shen.toplevel_evaluate (cons (hd V2378) ()) V2379) (do (nl 1) (shen.toplevel_evaluate (tl V2378) V2379)))) ((and (cons? V2378) (and (= () (tl V2378)) (= true V2379))) (shen.typecheck-and-evaluate (hd V2378) (gensym A))) ((and (cons? V2378) (and (= () (tl V2378)) (= false V2379))) (let Eval (shen.eval-without-macros (hd V2378)) (print Eval))) (true (shen.sys-error shen.toplevel_evaluate))))
|
124
124
|
|
125
|
-
(defun shen.typecheck-and-evaluate (
|
126
|
-
") (let Eval (shen.eval-without-macros
|
125
|
+
(defun shen.typecheck-and-evaluate (V2380 V2381) (let Typecheck (shen.typecheck V2380 V2381) (if (= Typecheck false) (simple-error "type error
|
126
|
+
") (let Eval (shen.eval-without-macros V2380) (let Type (shen.pretty-type Typecheck) (shen.prhush (shen.app Eval (cn " : " (shen.app Type "" shen.r)) shen.s) (stoutput)))))))
|
127
127
|
|
128
|
-
(defun shen.pretty-type (
|
128
|
+
(defun shen.pretty-type (V2382) (shen.mult_subst (value shen.*alphabet*) (shen.extract-pvars V2382) V2382))
|
129
129
|
|
130
|
-
(defun shen.extract-pvars (
|
130
|
+
(defun shen.extract-pvars (V2387) (cond ((shen.pvar? V2387) (cons V2387 ())) ((cons? V2387) (union (shen.extract-pvars (hd V2387)) (shen.extract-pvars (tl V2387)))) (true ())))
|
131
131
|
|
132
|
-
(defun shen.mult_subst (
|
132
|
+
(defun shen.mult_subst (V2392 V2393 V2394) (cond ((= () V2392) V2394) ((= () V2393) V2394) ((and (cons? V2392) (cons? V2393)) (shen.mult_subst (tl V2392) (tl V2393) (subst (hd V2392) (hd V2393) V2394))) (true (shen.sys-error shen.mult_subst))))
|
133
133
|
|
134
134
|
|
135
135
|
|
@@ -152,8 +152,6 @@
|
|
152
152
|
|
153
153
|
(declare intersection (cons (cons list (cons A ())) (cons --> (cons (cons (cons list (cons A ())) (cons --> (cons (cons list (cons A ())) ()))) ()))))
|
154
154
|
|
155
|
-
(declare kill (cons --> (cons A ())))
|
156
|
-
|
157
155
|
(declare language (cons --> (cons string ())))
|
158
156
|
|
159
157
|
(declare length (cons (cons list (cons A ())) (cons --> (cons number ()))))
|
@@ -204,7 +202,7 @@
|
|
204
202
|
|
205
203
|
(declare shen.proc-nl (cons string (cons --> (cons string ()))))
|
206
204
|
|
207
|
-
(declare profile-results (cons A (cons --> (cons
|
205
|
+
(declare profile-results (cons (cons A (cons --> (cons B ()))) (cons --> (cons (cons (cons A (cons --> (cons B ()))) (cons * (cons number ()))) ()))))
|
208
206
|
|
209
207
|
(declare protect (cons symbol (cons --> (cons symbol ()))))
|
210
208
|
|
@@ -274,8 +272,6 @@
|
|
274
272
|
|
275
273
|
(declare trap-error (cons A (cons --> (cons (cons (cons exception (cons --> (cons A ()))) (cons --> (cons A ()))) ()))))
|
276
274
|
|
277
|
-
(declare shen.truncate (cons string (cons --> (cons string ()))))
|
278
|
-
|
279
275
|
(declare tuple? (cons A (cons --> (cons boolean ()))))
|
280
276
|
|
281
277
|
(declare undefmacro (cons symbol (cons --> (cons symbol ()))))
|
@@ -47,59 +47,59 @@
|
|
47
47
|
* explains this license in full. *
|
48
48
|
* *
|
49
49
|
*****************************************************************************************
|
50
|
-
"(defun pr (
|
50
|
+
"(defun pr (V2238 V2239) (trap-error (shen.prh V2238 V2239 0) (lambda E V2238)))
|
51
51
|
|
52
|
-
(defun shen.prh (
|
52
|
+
(defun shen.prh (V2240 V2241 V2242) (shen.prh V2240 V2241 (shen.write-char-and-inc V2240 V2241 V2242)))
|
53
53
|
|
54
|
-
(defun shen.write-char-and-inc (
|
54
|
+
(defun shen.write-char-and-inc (V2243 V2244 V2245) (do (write-byte (string->n (pos V2243 V2245)) V2244) (+ V2245 1)))
|
55
55
|
|
56
|
-
(defun print (
|
56
|
+
(defun print (V2246) (let String (shen.insert V2246 "~S") (let Print (shen.prhush String (stoutput)) V2246)))
|
57
57
|
|
58
|
-
(defun shen.prhush (
|
58
|
+
(defun shen.prhush (V2247 V2248) (if (value *hush*) V2247 (pr V2247 V2248)))
|
59
59
|
|
60
|
-
(defun shen.mkstr (
|
60
|
+
(defun shen.mkstr (V2249 V2250) (cond ((string? V2249) (shen.mkstr-l (shen.proc-nl V2249) V2250)) (true (shen.mkstr-r (cons shen.proc-nl (cons V2249 ())) V2250))))
|
61
61
|
|
62
|
-
(defun shen.mkstr-l (
|
62
|
+
(defun shen.mkstr-l (V2251 V2252) (cond ((= () V2252) V2251) ((cons? V2252) (shen.mkstr-l (shen.insert-l (hd V2252) V2251) (tl V2252))) (true (shen.sys-error shen.mkstr-l))))
|
63
63
|
|
64
|
-
(defun shen.insert-l (
|
64
|
+
(defun shen.insert-l (V2255 V2256) (cond ((= "" V2256) "") ((and (shen.+string? V2256) (and (= "~" (pos V2256 0)) (and (shen.+string? (tlstr V2256)) (= "A" (pos (tlstr V2256) 0))))) (cons shen.app (cons V2255 (cons (tlstr (tlstr V2256)) (cons shen.a ()))))) ((and (shen.+string? V2256) (and (= "~" (pos V2256 0)) (and (shen.+string? (tlstr V2256)) (= "R" (pos (tlstr V2256) 0))))) (cons shen.app (cons V2255 (cons (tlstr (tlstr V2256)) (cons shen.r ()))))) ((and (shen.+string? V2256) (and (= "~" (pos V2256 0)) (and (shen.+string? (tlstr V2256)) (= "S" (pos (tlstr V2256) 0))))) (cons shen.app (cons V2255 (cons (tlstr (tlstr V2256)) (cons shen.s ()))))) ((shen.+string? V2256) (shen.factor-cn (cons cn (cons (pos V2256 0) (cons (shen.insert-l V2255 (tlstr V2256)) ()))))) ((and (cons? V2256) (and (= cn (hd V2256)) (and (cons? (tl V2256)) (and (cons? (tl (tl V2256))) (= () (tl (tl (tl V2256)))))))) (cons cn (cons (hd (tl V2256)) (cons (shen.insert-l V2255 (hd (tl (tl V2256)))) ())))) ((and (cons? V2256) (and (= shen.app (hd V2256)) (and (cons? (tl V2256)) (and (cons? (tl (tl V2256))) (and (cons? (tl (tl (tl V2256)))) (= () (tl (tl (tl (tl V2256)))))))))) (cons shen.app (cons (hd (tl V2256)) (cons (shen.insert-l V2255 (hd (tl (tl V2256)))) (tl (tl (tl V2256))))))) (true (shen.sys-error shen.insert-l))))
|
65
65
|
|
66
|
-
(defun shen.factor-cn (
|
66
|
+
(defun shen.factor-cn (V2257) (cond ((and (cons? V2257) (and (= cn (hd V2257)) (and (cons? (tl V2257)) (and (cons? (tl (tl V2257))) (and (cons? (hd (tl (tl V2257)))) (and (= cn (hd (hd (tl (tl V2257))))) (and (cons? (tl (hd (tl (tl V2257))))) (and (cons? (tl (tl (hd (tl (tl V2257)))))) (and (= () (tl (tl (tl (hd (tl (tl V2257))))))) (and (= () (tl (tl (tl V2257)))) (and (string? (hd (tl V2257))) (string? (hd (tl (hd (tl (tl V2257))))))))))))))))) (cons cn (cons (cn (hd (tl V2257)) (hd (tl (hd (tl (tl V2257)))))) (tl (tl (hd (tl (tl V2257)))))))) (true V2257)))
|
67
67
|
|
68
|
-
(defun shen.proc-nl (
|
68
|
+
(defun shen.proc-nl (V2258) (cond ((= "" V2258) "") ((and (shen.+string? V2258) (and (= "~" (pos V2258 0)) (and (shen.+string? (tlstr V2258)) (= "%" (pos (tlstr V2258) 0))))) (cn (n->string 10) (shen.proc-nl (tlstr (tlstr V2258))))) ((shen.+string? V2258) (cn (pos V2258 0) (shen.proc-nl (tlstr V2258)))) (true (shen.sys-error shen.proc-nl))))
|
69
69
|
|
70
|
-
(defun shen.mkstr-r (
|
70
|
+
(defun shen.mkstr-r (V2259 V2260) (cond ((= () V2260) V2259) ((cons? V2260) (shen.mkstr-r (cons shen.insert (cons (hd V2260) (cons V2259 ()))) (tl V2260))) (true (shen.sys-error shen.mkstr-r))))
|
71
71
|
|
72
|
-
(defun shen.insert (
|
72
|
+
(defun shen.insert (V2261 V2262) (shen.insert-h V2261 V2262 ""))
|
73
73
|
|
74
|
-
(defun shen.insert-h (
|
74
|
+
(defun shen.insert-h (V2265 V2266 V2267) (cond ((= "" V2266) V2267) ((and (shen.+string? V2266) (and (= "~" (pos V2266 0)) (and (shen.+string? (tlstr V2266)) (= "A" (pos (tlstr V2266) 0))))) (cn V2267 (shen.app V2265 (tlstr (tlstr V2266)) shen.a))) ((and (shen.+string? V2266) (and (= "~" (pos V2266 0)) (and (shen.+string? (tlstr V2266)) (= "R" (pos (tlstr V2266) 0))))) (cn V2267 (shen.app V2265 (tlstr (tlstr V2266)) shen.r))) ((and (shen.+string? V2266) (and (= "~" (pos V2266 0)) (and (shen.+string? (tlstr V2266)) (= "S" (pos (tlstr V2266) 0))))) (cn V2267 (shen.app V2265 (tlstr (tlstr V2266)) shen.s))) ((shen.+string? V2266) (shen.insert-h V2265 (tlstr V2266) (cn V2267 (pos V2266 0)))) (true (shen.sys-error shen.insert-h))))
|
75
75
|
|
76
|
-
(defun shen.app (
|
76
|
+
(defun shen.app (V2268 V2269 V2270) (cn (shen.arg->str V2268 V2270) V2269))
|
77
77
|
|
78
|
-
(defun shen.arg->str (
|
78
|
+
(defun shen.arg->str (V2276 V2277) (cond ((= V2276 (fail)) "...") ((shen.list? V2276) (shen.list->str V2276 V2277)) ((string? V2276) (shen.str->str V2276 V2277)) ((absvector? V2276) (shen.vector->str V2276 V2277)) (true (shen.atom->str V2276))))
|
79
79
|
|
80
|
-
(defun shen.list->str (
|
80
|
+
(defun shen.list->str (V2278 V2279) (cond ((= shen.r V2279) (@s "(" (@s (shen.iter-list V2278 shen.r (shen.maxseq)) ")"))) (true (@s "[" (@s (shen.iter-list V2278 V2279 (shen.maxseq)) "]")))))
|
81
81
|
|
82
82
|
(defun shen.maxseq () (value *maximum-print-sequence-size*))
|
83
83
|
|
84
|
-
(defun shen.iter-list (
|
84
|
+
(defun shen.iter-list (V2290 V2291 V2292) (cond ((= () V2290) "") ((= 0 V2292) "... etc") ((and (cons? V2290) (= () (tl V2290))) (shen.arg->str (hd V2290) V2291)) ((cons? V2290) (@s (shen.arg->str (hd V2290) V2291) (@s " " (shen.iter-list (tl V2290) V2291 (- V2292 1))))) (true (@s "|" (@s " " (shen.arg->str V2290 V2291))))))
|
85
85
|
|
86
|
-
(defun shen.str->str (
|
86
|
+
(defun shen.str->str (V2297 V2298) (cond ((= shen.a V2298) V2297) (true (@s (n->string 34) (@s V2297 (n->string 34))))))
|
87
87
|
|
88
|
-
(defun shen.vector->str (
|
88
|
+
(defun shen.vector->str (V2299 V2300) (if (shen.print-vector? V2299) ((<-address V2299 0) V2299) (if (vector? V2299) (@s "<" (@s (shen.iter-vector V2299 1 V2300 (shen.maxseq)) ">")) (@s "<" (@s "<" (@s (shen.iter-vector V2299 0 V2300 (shen.maxseq)) ">>"))))))
|
89
89
|
|
90
|
-
(defun shen.print-vector? (
|
90
|
+
(defun shen.print-vector? (V2301) (let Zero (<-address V2301 0) (if (= Zero shen.tuple) true (if (= Zero shen.pvar) true (if (not (number? Zero)) (shen.fbound? Zero) false)))))
|
91
91
|
|
92
|
-
(defun shen.fbound? (
|
92
|
+
(defun shen.fbound? (V2302) (trap-error (do (ps V2302) true) (lambda E false)))
|
93
93
|
|
94
|
-
(defun shen.tuple (
|
94
|
+
(defun shen.tuple (V2303) (cn "(@p " (shen.app (<-address V2303 1) (cn " " (shen.app (<-address V2303 2) ")" shen.s)) shen.s)))
|
95
95
|
|
96
|
-
(defun shen.iter-vector (
|
96
|
+
(defun shen.iter-vector (V2310 V2311 V2312 V2313) (cond ((= 0 V2313) "... etc") (true (let Item (trap-error (<-address V2310 V2311) (lambda E shen.out-of-bounds)) (let Next (trap-error (<-address V2310 (+ V2311 1)) (lambda E shen.out-of-bounds)) (if (= Item shen.out-of-bounds) "" (if (= Next shen.out-of-bounds) (shen.arg->str Item V2312) (@s (shen.arg->str Item V2312) (@s " " (shen.iter-vector V2310 (+ V2311 1) V2312 (- V2313 1)))))))))))
|
97
97
|
|
98
|
-
(defun shen.atom->str (
|
98
|
+
(defun shen.atom->str (V2314) (trap-error (str V2314) (lambda E (shen.funexstring))))
|
99
99
|
|
100
100
|
(defun shen.funexstring () (@s "" (@s "f" (@s "u" (@s "n" (@s "e" (@s (shen.arg->str (gensym (intern "x")) shen.a) "")))))))
|
101
101
|
|
102
|
-
(defun shen.list? (
|
102
|
+
(defun shen.list? (V2315) (or (empty? V2315) (cons? V2315)))
|
103
103
|
|
104
104
|
|
105
105
|
|
@@ -47,59 +47,61 @@
|
|
47
47
|
* explains this license in full. *
|
48
48
|
* *
|
49
49
|
*****************************************************************************************
|
50
|
-
"(defun shen.yacc (V2133) (cond ((and (cons? V2133) (and (= defcc (hd V2133)) (cons? (tl V2133)))) (shen.yacc->shen (hd (tl V2133)) (tl (tl V2133)))) (true (shen.sys-error shen.yacc))))
|
50
|
+
"(defun shen.yacc (V2133) (cond ((and (cons? V2133) (and (= defcc (hd V2133)) (and (cons? (tl V2133)) (and (cons? (tl (tl V2133))) (and (= { (hd (tl (tl V2133)))) (and (cons? (tl (tl (tl V2133)))) (and (cons? (tl (tl (tl (tl V2133))))) (and (= ==> (hd (tl (tl (tl (tl V2133)))))) (and (cons? (tl (tl (tl (tl (tl V2133)))))) (and (cons? (tl (tl (tl (tl (tl (tl V2133))))))) (= } (hd (tl (tl (tl (tl (tl (tl V2133)))))))))))))))))) (shen.yacc (cons defcc (cons (hd (tl V2133)) (tl (tl (tl (tl (tl (tl (tl V2133))))))))))) ((and (cons? V2133) (and (= defcc (hd V2133)) (cons? (tl V2133)))) (shen.yacc->shen (hd (tl V2133)) (tl (tl V2133)))) (true (shen.sys-error shen.yacc))))
|
51
51
|
|
52
|
-
(defun shen.yacc->shen (V2134 V2135) (let CCRules (shen.split_cc_rules V2135 ()) (let CCBody (map shen.cc_body CCRules) (let YaccCases (shen.yacc_cases CCBody) (cons define (cons V2134 (cons Stream (cons -> (cons YaccCases ())))))))))
|
52
|
+
(defun shen.yacc->shen (V2134 V2135) (let CCRules (shen.split_cc_rules true V2135 ()) (let CCBody (map shen.cc_body CCRules) (let YaccCases (shen.yacc_cases CCBody) (cons define (cons V2134 (cons Stream (cons -> (cons YaccCases ())))))))))
|
53
53
|
|
54
|
-
(defun shen.split_cc_rules (
|
54
|
+
(defun shen.split_cc_rules (V2138 V2139 V2140) (cond ((and (= () V2139) (= () V2140)) ()) ((= () V2139) (cons (shen.split_cc_rule V2138 (reverse V2140) ()) ())) ((and (cons? V2139) (= ; (hd V2139))) (cons (shen.split_cc_rule V2138 (reverse V2140) ()) (shen.split_cc_rules V2138 (tl V2139) ()))) ((cons? V2139) (shen.split_cc_rules V2138 (tl V2139) (cons (hd V2139) V2140))) (true (shen.sys-error shen.split_cc_rules))))
|
55
55
|
|
56
|
-
(defun shen.split_cc_rule (
|
57
|
-
" (stoutput)) (shen.split_cc_rule (cons := (cons (shen.default_semantics (reverse V2139)) ())) V2139))))) ((cons? V2138) (shen.split_cc_rule (tl V2138) (cons (hd V2138) V2139))) (true (shen.sys-error shen.split_cc_rule))))
|
56
|
+
(defun shen.split_cc_rule (V2145 V2146 V2147) (cond ((and (cons? V2146) (and (= := (hd V2146)) (and (cons? (tl V2146)) (= () (tl (tl V2146)))))) (cons (reverse V2147) (tl V2146))) ((and (cons? V2146) (and (= := (hd V2146)) (and (cons? (tl V2146)) (and (cons? (tl (tl V2146))) (and (= where (hd (tl (tl V2146)))) (and (cons? (tl (tl (tl V2146)))) (= () (tl (tl (tl (tl V2146))))))))))) (cons (reverse V2147) (cons (cons where (cons (hd (tl (tl (tl V2146)))) (cons (hd (tl V2146)) ()))) ()))) ((= () V2146) (do (shen.semantic-completion-warning V2145 V2147) (shen.split_cc_rule V2145 (cons := (cons (shen.default_semantics (reverse V2147)) ())) V2147))) ((cons? V2146) (shen.split_cc_rule V2145 (tl V2146) (cons (hd V2146) V2147))) (true (shen.sys-error shen.split_cc_rule))))
|
58
57
|
|
59
|
-
(defun shen.
|
58
|
+
(defun shen.semantic-completion-warning (V2156 V2157) (cond ((= true V2156) (do (shen.prhush "warning: " (stoutput)) (do (map (lambda X (shen.prhush (shen.app X " " shen.a) (stoutput))) (reverse V2157)) (shen.prhush "has no semantics.
|
59
|
+
" (stoutput))))) (true shen.skip)))
|
60
60
|
|
61
|
-
(defun shen.
|
61
|
+
(defun shen.default_semantics (V2158) (cond ((= () V2158) ()) ((and (cons? V2158) (and (= () (tl V2158)) (shen.grammar_symbol? (hd V2158)))) (hd V2158)) ((and (cons? V2158) (shen.grammar_symbol? (hd V2158))) (cons append (cons (hd V2158) (cons (shen.default_semantics (tl V2158)) ())))) ((cons? V2158) (cons cons (cons (hd V2158) (cons (shen.default_semantics (tl V2158)) ())))) (true (shen.sys-error shen.default_semantics))))
|
62
62
|
|
63
|
-
(defun shen.
|
63
|
+
(defun shen.grammar_symbol? (V2159) (and (symbol? V2159) (let Cs (shen.strip-pathname (explode V2159)) (and (= (hd Cs) "<") (= (hd (reverse Cs)) ">")))))
|
64
64
|
|
65
|
-
(defun shen.
|
65
|
+
(defun shen.yacc_cases (V2160) (cond ((and (cons? V2160) (= () (tl V2160))) (hd V2160)) ((cons? V2160) (let P YaccParse (cons let (cons P (cons (hd V2160) (cons (cons if (cons (cons = (cons P (cons (cons fail ()) ()))) (cons (shen.yacc_cases (tl V2160)) (cons P ())))) ())))))) (true (shen.sys-error shen.yacc_cases))))
|
66
66
|
|
67
|
-
(defun shen.
|
67
|
+
(defun shen.cc_body (V2161) (cond ((and (cons? V2161) (and (cons? (tl V2161)) (= () (tl (tl V2161))))) (shen.syntax (hd V2161) Stream (hd (tl V2161)))) (true (shen.sys-error shen.cc_body))))
|
68
|
+
|
69
|
+
(defun shen.syntax (V2162 V2163 V2164) (cond ((and (= () V2162) (and (cons? V2164) (and (= where (hd V2164)) (and (cons? (tl V2164)) (and (cons? (tl (tl V2164))) (= () (tl (tl (tl V2164))))))))) (cons if (cons (shen.semantics (hd (tl V2164))) (cons (cons shen.pair (cons (cons hd (cons V2163 ())) (cons (shen.semantics (hd (tl (tl V2164)))) ()))) (cons (cons fail ()) ()))))) ((= () V2162) (cons shen.pair (cons (cons hd (cons V2163 ())) (cons (shen.semantics V2164) ())))) ((cons? V2162) (if (shen.grammar_symbol? (hd V2162)) (shen.recursive_descent V2162 V2163 V2164) (if (variable? (hd V2162)) (shen.variable-match V2162 V2163 V2164) (if (shen.jump_stream? (hd V2162)) (shen.jump_stream V2162 V2163 V2164) (if (shen.terminal? (hd V2162)) (shen.check_stream V2162 V2163 V2164) (if (cons? (hd V2162)) (shen.list-stream (shen.decons (hd V2162)) (tl V2162) V2163 V2164) (simple-error (shen.app (hd V2162) " is not legal syntax
|
68
70
|
" shen.a)))))))) (true (shen.sys-error shen.syntax))))
|
69
71
|
|
70
|
-
(defun shen.list-stream (
|
72
|
+
(defun shen.list-stream (V2165 V2166 V2167 V2168) (let Test (cons and (cons (cons cons? (cons (cons hd (cons V2167 ())) ())) (cons (cons cons? (cons (cons hd (cons (cons hd (cons V2167 ())) ())) ())) ()))) (let Placeholder (gensym shen.place) (let RunOn (shen.syntax V2166 (cons shen.pair (cons (cons tl (cons (cons hd (cons V2167 ())) ())) (cons (cons hd (cons (cons tl (cons V2167 ())) ())) ()))) V2168) (let Action (shen.insert-runon RunOn Placeholder (shen.syntax V2165 (cons shen.pair (cons (cons hd (cons (cons hd (cons V2167 ())) ())) (cons (cons hd (cons (cons tl (cons V2167 ())) ())) ()))) Placeholder)) (cons if (cons Test (cons Action (cons (cons fail ()) ())))))))))
|
71
73
|
|
72
|
-
(defun shen.decons (
|
74
|
+
(defun shen.decons (V2169) (cond ((and (cons? V2169) (and (= cons (hd V2169)) (and (cons? (tl V2169)) (and (cons? (tl (tl V2169))) (and (= () (hd (tl (tl V2169)))) (= () (tl (tl (tl V2169))))))))) (cons (hd (tl V2169)) ())) ((and (cons? V2169) (and (= cons (hd V2169)) (and (cons? (tl V2169)) (and (cons? (tl (tl V2169))) (= () (tl (tl (tl V2169)))))))) (cons (hd (tl V2169)) (shen.decons (hd (tl (tl V2169)))))) (true V2169)))
|
73
75
|
|
74
|
-
(defun shen.insert-runon (
|
76
|
+
(defun shen.insert-runon (V2180 V2181 V2182) (cond ((and (cons? V2182) (and (= shen.pair (hd V2182)) (and (cons? (tl V2182)) (and (cons? (tl (tl V2182))) (and (= () (tl (tl (tl V2182)))) (= (hd (tl (tl V2182))) V2181)))))) V2180) ((cons? V2182) (map (lambda Z (shen.insert-runon V2180 V2181 Z)) V2182)) (true V2182)))
|
75
77
|
|
76
|
-
(defun shen.strip-pathname (
|
78
|
+
(defun shen.strip-pathname (V2188) (cond ((not (element? "." V2188)) V2188) ((cons? V2188) (shen.strip-pathname (tl V2188))) (true (shen.sys-error shen.strip-pathname))))
|
77
79
|
|
78
|
-
(defun shen.recursive_descent (
|
80
|
+
(defun shen.recursive_descent (V2189 V2190 V2191) (cond ((cons? V2189) (let Test (cons (hd V2189) (cons V2190 ())) (let Action (shen.syntax (tl V2189) (concat Parse_ (hd V2189)) V2191) (let Else (cons fail ()) (cons let (cons (concat Parse_ (hd V2189)) (cons Test (cons (cons if (cons (cons not (cons (cons = (cons (cons fail ()) (cons (concat Parse_ (hd V2189)) ()))) ())) (cons Action (cons Else ())))) ())))))))) (true (shen.sys-error shen.recursive_descent))))
|
79
81
|
|
80
|
-
(defun shen.variable-match (
|
82
|
+
(defun shen.variable-match (V2192 V2193 V2194) (cond ((cons? V2192) (let Test (cons cons? (cons (cons hd (cons V2193 ())) ())) (let Action (cons let (cons (concat Parse_ (hd V2192)) (cons (cons hd (cons (cons hd (cons V2193 ())) ())) (cons (shen.syntax (tl V2192) (cons shen.pair (cons (cons tl (cons (cons hd (cons V2193 ())) ())) (cons (cons shen.hdtl (cons V2193 ())) ()))) V2194) ())))) (let Else (cons fail ()) (cons if (cons Test (cons Action (cons Else ())))))))) (true (shen.sys-error shen.variable-match))))
|
81
83
|
|
82
|
-
(defun shen.terminal? (
|
84
|
+
(defun shen.terminal? (V2203) (cond ((cons? V2203) false) ((variable? V2203) false) (true true)))
|
83
85
|
|
84
|
-
(defun shen.jump_stream? (
|
86
|
+
(defun shen.jump_stream? (V2208) (cond ((= V2208 _) true) (true false)))
|
85
87
|
|
86
|
-
(defun shen.check_stream (
|
88
|
+
(defun shen.check_stream (V2209 V2210 V2211) (cond ((cons? V2209) (let Test (cons and (cons (cons cons? (cons (cons hd (cons V2210 ())) ())) (cons (cons = (cons (hd V2209) (cons (cons hd (cons (cons hd (cons V2210 ())) ())) ()))) ()))) (let Action (shen.syntax (tl V2209) (cons shen.pair (cons (cons tl (cons (cons hd (cons V2210 ())) ())) (cons (cons shen.hdtl (cons V2210 ())) ()))) V2211) (let Else (cons fail ()) (cons if (cons Test (cons Action (cons Else ())))))))) (true (shen.sys-error shen.check_stream))))
|
87
89
|
|
88
|
-
(defun shen.jump_stream (
|
90
|
+
(defun shen.jump_stream (V2212 V2213 V2214) (cond ((cons? V2212) (let Test (cons cons? (cons (cons hd (cons V2213 ())) ())) (let Action (shen.syntax (tl V2212) (cons shen.pair (cons (cons tl (cons (cons hd (cons V2213 ())) ())) (cons (cons shen.hdtl (cons V2213 ())) ()))) V2214) (let Else (cons fail ()) (cons if (cons Test (cons Action (cons Else ())))))))) (true (shen.sys-error shen.jump_stream))))
|
89
91
|
|
90
|
-
(defun shen.semantics (
|
92
|
+
(defun shen.semantics (V2215) (cond ((= () V2215) ()) ((shen.grammar_symbol? V2215) (cons shen.hdtl (cons (concat Parse_ V2215) ()))) ((variable? V2215) (concat Parse_ V2215)) ((cons? V2215) (map shen.semantics V2215)) (true V2215)))
|
91
93
|
|
92
|
-
(defun shen.snd-or-fail (
|
94
|
+
(defun shen.snd-or-fail (V2222) (cond ((and (cons? V2222) (and (cons? (tl V2222)) (= () (tl (tl V2222))))) (hd (tl V2222))) (true (fail))))
|
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
|
|
data/shen-ruby.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.email = ["greg@sourcematters.org"]
|
13
13
|
s.homepage = "https://github.com/gregspurrier/shen-ruby"
|
14
14
|
s.summary = %q{ShenRuby is a Ruby port of the Shen programming language}
|
15
|
-
s.description = %q{ShenRuby is a port of the Shen programming language to Ruby. It currently supports Shen version 14.}
|
15
|
+
s.description = %q{ShenRuby is a port of the Shen programming language to Ruby. It currently supports Shen version 14.2.}
|
16
16
|
|
17
17
|
s.required_ruby_version = ">= 1.9.3"
|
18
18
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shen-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
5
|
-
prerelease:
|
4
|
+
version: 0.8.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Greg Spurrier
|
@@ -10,12 +9,11 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2014-01-28 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rspec
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
18
|
- - ~>
|
21
19
|
- !ruby/object:Gem::Version
|
@@ -23,13 +21,12 @@ dependencies:
|
|
23
21
|
type: :development
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
25
|
- - ~>
|
29
26
|
- !ruby/object:Gem::Version
|
30
27
|
version: '2.12'
|
31
28
|
description: ShenRuby is a port of the Shen programming language to Ruby. It currently
|
32
|
-
supports Shen version 14.
|
29
|
+
supports Shen version 14.2.
|
33
30
|
email:
|
34
31
|
- greg@sourcematters.org
|
35
32
|
executables:
|
@@ -171,28 +168,27 @@ files:
|
|
171
168
|
homepage: https://github.com/gregspurrier/shen-ruby
|
172
169
|
licenses:
|
173
170
|
- Shen License
|
171
|
+
metadata: {}
|
174
172
|
post_install_message:
|
175
173
|
rdoc_options: []
|
176
174
|
require_paths:
|
177
175
|
- lib
|
178
176
|
- shen/lib
|
179
177
|
required_ruby_version: !ruby/object:Gem::Requirement
|
180
|
-
none: false
|
181
178
|
requirements:
|
182
|
-
- -
|
179
|
+
- - '>='
|
183
180
|
- !ruby/object:Gem::Version
|
184
181
|
version: 1.9.3
|
185
182
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
|
-
none: false
|
187
183
|
requirements:
|
188
|
-
- -
|
184
|
+
- - '>='
|
189
185
|
- !ruby/object:Gem::Version
|
190
186
|
version: '0'
|
191
187
|
requirements: []
|
192
188
|
rubyforge_project:
|
193
|
-
rubygems_version:
|
189
|
+
rubygems_version: 2.0.14
|
194
190
|
signing_key:
|
195
|
-
specification_version:
|
191
|
+
specification_version: 4
|
196
192
|
summary: ShenRuby is a Ruby port of the Shen programming language
|
197
193
|
test_files:
|
198
194
|
- spec/kl/cons_spec.rb
|