shen-ruby 0.8.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +4 -0
- data/README.md +4 -4
- data/lib/shen_ruby/version.rb +1 -1
- data/shen/release/k_lambda/core.kl +63 -63
- data/shen/release/k_lambda/declarations.kl +59 -10
- data/shen/release/k_lambda/load.kl +15 -15
- data/shen/release/k_lambda/macros.kl +31 -29
- data/shen/release/k_lambda/prolog.kl +97 -97
- data/shen/release/k_lambda/reader.kl +79 -79
- data/shen/release/k_lambda/sequent.kl +60 -54
- data/shen/release/k_lambda/sys.kl +98 -98
- data/shen/release/k_lambda/t-star.kl +47 -47
- data/shen/release/k_lambda/toplevel.kl +21 -21
- data/shen/release/k_lambda/track.kl +25 -25
- data/shen/release/k_lambda/types.kl +4 -8
- data/shen/release/k_lambda/writer.kl +25 -25
- data/shen/release/k_lambda/yacc.kl +32 -26
- data/shen-ruby.gemspec +1 -1
- metadata +3 -3
@@ -47,38 +47,38 @@
|
|
47
47
|
* explains this license in full. *
|
48
48
|
* *
|
49
49
|
*****************************************************************************************
|
50
|
-
"(defun load (
|
50
|
+
"(defun load (V839) (let Load (let Start (get-time run) (let Result (shen.load-help (value shen.*tc*) (read-file V839)) (let Finish (get-time run) (let Time (- Finish Start) (let Message (shen.prhush (cn "
|
51
51
|
run time: " (cn (str Time) " secs
|
52
52
|
")) (stoutput)) Result))))) (let Infs (if (value shen.*tc*) (shen.prhush (cn "
|
53
53
|
typechecked in " (shen.app (inferences) " inferences
|
54
54
|
" shen.a)) (stoutput)) shen.skip) loaded)))
|
55
55
|
|
56
|
-
(defun shen.load-help (
|
57
|
-
" shen.s) (stoutput)))
|
56
|
+
(defun shen.load-help (V844 V845) (cond ((= false V844) (map (lambda X (shen.prhush (shen.app (shen.eval-without-macros X) "
|
57
|
+
" shen.s) (stoutput))) V845)) (true (let RemoveSynonyms (mapcan (lambda X834 (shen.remove-synonyms X834)) V845) (let Table (mapcan (lambda X835 (shen.typetable X835)) RemoveSynonyms) (let Assume (map (lambda X836 (shen.assumetype X836)) Table) (trap-error (map (lambda X837 (shen.typecheck-and-load X837)) RemoveSynonyms) (lambda E (shen.unwind-types E Table)))))))))
|
58
58
|
|
59
|
-
(defun shen.remove-synonyms (
|
59
|
+
(defun shen.remove-synonyms (V846) (cond ((and (cons? V846) (= shen.synonyms-help (hd V846))) (do (eval V846) ())) (true (cons V846 ()))))
|
60
60
|
|
61
|
-
(defun shen.typecheck-and-load (
|
61
|
+
(defun shen.typecheck-and-load (V847) (do (nl 1) (shen.typecheck-and-evaluate V847 (gensym A))))
|
62
62
|
|
63
|
-
(defun shen.typetable (
|
64
|
-
" shen.a)) (cons (cons (hd (tl
|
63
|
+
(defun shen.typetable (V856) (cond ((and (cons? V856) (and (= define (hd V856)) (cons? (tl V856)))) (let Sig (compile (lambda X838 (shen.<sig+rest> X838)) (tl (tl V856)) ()) (if (= Sig (fail)) (simple-error (shen.app (hd (tl V856)) " lacks a proper signature.
|
64
|
+
" shen.a)) (cons (cons (hd (tl V856)) Sig) ())))) ((and (cons? V856) (and (= defcc (hd V856)) (and (cons? (tl V856)) (and (cons? (tl (tl V856))) (and (= { (hd (tl (tl V856)))) (and (cons? (tl (tl (tl V856)))) (and (cons? (hd (tl (tl (tl V856))))) (and (= list (hd (hd (tl (tl (tl V856)))))) (and (cons? (tl (hd (tl (tl (tl V856)))))) (and (= () (tl (tl (hd (tl (tl (tl V856))))))) (and (cons? (tl (tl (tl (tl V856))))) (and (= ==> (hd (tl (tl (tl (tl V856)))))) (and (cons? (tl (tl (tl (tl (tl V856)))))) (and (cons? (tl (tl (tl (tl (tl (tl V856))))))) (= } (hd (tl (tl (tl (tl (tl (tl V856)))))))))))))))))))))) (cons (cons (hd (tl V856)) (cons (hd (tl (tl (tl V856)))) (cons ==> (cons (hd (tl (tl (tl (tl (tl V856)))))) ())))) ())) ((and (cons? V856) (and (= defcc (hd V856)) (cons? (tl V856)))) (simple-error (shen.app (hd (tl V856)) " lacks a proper signature.
|
65
65
|
" shen.a))) (true ())))
|
66
66
|
|
67
|
-
(defun shen.assumetype (
|
67
|
+
(defun shen.assumetype (V857) (cond ((cons? V857) (declare (hd V857) (tl V857))) (true (shen.sys-error shen.assumetype))))
|
68
68
|
|
69
|
-
(defun shen.unwind-types (
|
69
|
+
(defun shen.unwind-types (V862 V863) (cond ((= () V863) (simple-error (error-to-string V862))) ((and (cons? V863) (cons? (hd V863))) (do (shen.remtype (hd (hd V863))) (shen.unwind-types V862 (tl V863)))) (true (shen.sys-error shen.unwind-types))))
|
70
70
|
|
71
|
-
(defun shen.remtype (
|
71
|
+
(defun shen.remtype (V864) (set shen.*signedfuncs* (shen.removetype V864 (value shen.*signedfuncs*))))
|
72
72
|
|
73
|
-
(defun shen.removetype (
|
73
|
+
(defun shen.removetype (V869 V870) (cond ((= () V870) ()) ((and (cons? V870) (and (cons? (hd V870)) (= (hd (hd V870)) V869))) (shen.removetype (hd (hd V870)) (tl V870))) ((cons? V870) (cons (hd V870) (shen.removetype V869 (tl V870)))) (true (shen.sys-error shen.removetype))))
|
74
74
|
|
75
|
-
(defun shen.<sig+rest> (
|
75
|
+
(defun shen.<sig+rest> (V876) (let Result (let Parse_shen.<signature> (shen.<signature> V876) (if (not (= (fail) Parse_shen.<signature>)) (let Parse_<!> (<!> Parse_shen.<signature>) (if (not (= (fail) Parse_<!>)) (shen.pair (hd Parse_<!>) (shen.hdtl Parse_shen.<signature>)) (fail))) (fail))) (if (= Result (fail)) (fail) Result)))
|
76
76
|
|
77
|
-
(defun write-to-file (
|
77
|
+
(defun write-to-file (V877 V878) (let Stream (open V877 out) (let String (if (string? V878) (shen.app V878 "
|
78
78
|
|
79
|
-
" shen.a) (shen.app
|
79
|
+
" shen.a) (shen.app V878 "
|
80
80
|
|
81
|
-
" shen.s)) (let Write (pr String Stream) (let Close (close Stream)
|
81
|
+
" shen.s)) (let Write (pr String Stream) (let Close (close Stream) V878)))))
|
82
82
|
|
83
83
|
|
84
84
|
|
@@ -47,33 +47,33 @@
|
|
47
47
|
* explains this license in full. *
|
48
48
|
* *
|
49
49
|
*****************************************************************************************
|
50
|
-
"(defun macroexpand (
|
50
|
+
"(defun macroexpand (V882) (let Y (shen.compose (value *macros*) V882) (if (= V882 Y) V882 (shen.walk (lambda X879 (macroexpand X879)) Y))))
|
51
51
|
|
52
52
|
(set *macros* (cons shen.timer-macro (cons shen.cases-macro (cons shen.abs-macro (cons shen.put/get-macro (cons shen.compile-macro (cons shen.datatype-macro (cons shen.let-macro (cons shen.assoc-macro (cons shen.make-string-macro (cons shen.output-macro (cons shen.input-macro (cons shen.error-macro (cons shen.prolog-macro (cons shen.synonyms-macro (cons shen.nl-macro (cons shen.@s-macro (cons shen.defprolog-macro (cons shen.function-macro ())))))))))))))))))))
|
53
53
|
|
54
|
-
(defun shen.error-macro (
|
54
|
+
(defun shen.error-macro (V883) (cond ((and (cons? V883) (and (= error (hd V883)) (cons? (tl V883)))) (cons simple-error (cons (shen.mkstr (hd (tl V883)) (tl (tl V883))) ()))) (true V883)))
|
55
55
|
|
56
|
-
(defun shen.output-macro (
|
56
|
+
(defun shen.output-macro (V884) (cond ((and (cons? V884) (and (= output (hd V884)) (cons? (tl V884)))) (cons shen.prhush (cons (shen.mkstr (hd (tl V884)) (tl (tl V884))) (cons (cons stoutput ()) ())))) ((and (cons? V884) (and (= pr (hd V884)) (and (cons? (tl V884)) (= () (tl (tl V884)))))) (cons pr (cons (hd (tl V884)) (cons (cons stoutput ()) ())))) (true V884)))
|
57
57
|
|
58
|
-
(defun shen.make-string-macro (
|
58
|
+
(defun shen.make-string-macro (V885) (cond ((and (cons? V885) (and (= make-string (hd V885)) (cons? (tl V885)))) (shen.mkstr (hd (tl V885)) (tl (tl V885)))) (true V885)))
|
59
59
|
|
60
|
-
(defun shen.input-macro (
|
60
|
+
(defun shen.input-macro (V886) (cond ((and (cons? V886) (and (= lineread (hd V886)) (= () (tl V886)))) (cons lineread (cons (cons stinput ()) ()))) ((and (cons? V886) (and (= input (hd V886)) (= () (tl V886)))) (cons input (cons (cons stinput ()) ()))) ((and (cons? V886) (and (= read (hd V886)) (= () (tl V886)))) (cons read (cons (cons stinput ()) ()))) ((and (cons? V886) (and (= input+ (hd V886)) (and (cons? (tl V886)) (= () (tl (tl V886)))))) (cons input+ (cons (hd (tl V886)) (cons (cons stinput ()) ())))) ((and (cons? V886) (and (= read-byte (hd V886)) (= () (tl V886)))) (cons read-byte (cons (cons stinput ()) ()))) (true V886)))
|
61
61
|
|
62
|
-
(defun shen.compose (
|
62
|
+
(defun shen.compose (V887 V888) (cond ((= () V887) V888) ((cons? V887) (shen.compose (tl V887) ((hd V887) V888))) (true (shen.sys-error shen.compose))))
|
63
63
|
|
64
|
-
(defun shen.compile-macro (
|
64
|
+
(defun shen.compile-macro (V889) (cond ((and (cons? V889) (and (= compile (hd V889)) (and (cons? (tl V889)) (and (cons? (tl (tl V889))) (= () (tl (tl (tl V889)))))))) (cons compile (cons (hd (tl V889)) (cons (hd (tl (tl V889))) (cons (cons lambda (cons E (cons (cons if (cons (cons cons? (cons E ())) (cons (cons error (cons "parse error here: ~S~%" (cons E ()))) (cons (cons error (cons "parse error~%" ())) ())))) ()))) ()))))) (true V889)))
|
65
65
|
|
66
|
-
(defun shen.prolog-macro (
|
66
|
+
(defun shen.prolog-macro (V890) (cond ((and (cons? V890) (= prolog? (hd V890))) (let F (gensym shen.f) (let Receive (shen.receive-terms (tl V890)) (let PrologDef (eval (append (cons defprolog (cons F ())) (append Receive (append (cons <-- ()) (append (shen.pass-literals (tl V890)) (cons ; ())))))) (let Query (cons F (append Receive (cons (cons shen.start-new-prolog-process ()) (cons (cons freeze (cons true ())) ())))) Query))))) (true V890)))
|
67
67
|
|
68
|
-
(defun shen.receive-terms (
|
68
|
+
(defun shen.receive-terms (V895) (cond ((= () V895) ()) ((and (cons? V895) (and (cons? (hd V895)) (and (= receive (hd (hd V895))) (and (cons? (tl (hd V895))) (= () (tl (tl (hd V895)))))))) (cons (hd (tl (hd V895))) (shen.receive-terms (tl V895)))) ((cons? V895) (shen.receive-terms (tl V895))) (true (shen.sys-error shen.receive-terms))))
|
69
69
|
|
70
|
-
(defun shen.pass-literals (
|
70
|
+
(defun shen.pass-literals (V898) (cond ((= () V898) ()) ((and (cons? V898) (and (cons? (hd V898)) (and (= receive (hd (hd V898))) (and (cons? (tl (hd V898))) (= () (tl (tl (hd V898)))))))) (shen.pass-literals (tl V898))) ((cons? V898) (cons (hd V898) (shen.pass-literals (tl V898)))) (true (shen.sys-error shen.pass-literals))))
|
71
71
|
|
72
|
-
(defun shen.defprolog-macro (
|
72
|
+
(defun shen.defprolog-macro (V899) (cond ((and (cons? V899) (and (= defprolog (hd V899)) (cons? (tl V899)))) (compile (lambda X880 (shen.<defprolog> X880)) (tl V899) (lambda Y (shen.prolog-error (hd (tl V899)) Y)))) (true V899)))
|
73
73
|
|
74
|
-
(defun shen.datatype-macro (
|
74
|
+
(defun shen.datatype-macro (V900) (cond ((and (cons? V900) (and (= datatype (hd V900)) (cons? (tl V900)))) (cons shen.process-datatype (cons (shen.intern-type (hd (tl V900))) (cons (cons compile (cons (cons function (cons shen.<datatype-rules> ())) (cons (shen.rcons_form (tl (tl V900))) (cons (cons function (cons shen.datatype-error ())) ())))) ())))) (true V900)))
|
75
75
|
|
76
|
-
(defun shen.intern-type (
|
76
|
+
(defun shen.intern-type (V901) (intern (cn "type#" (str V901))))
|
77
77
|
|
78
78
|
"(defcc <defmacro>
|
79
79
|
<name> <macrorules> := [define <name> | <macrorules>];)
|
@@ -91,36 +91,38 @@
|
|
91
91
|
(defcc <macroaction>
|
92
92
|
<action> := [[walk [function macroexpand] <action>]];)"
|
93
93
|
|
94
|
-
(defun shen.@s-macro (
|
94
|
+
(defun shen.@s-macro (V902) (cond ((and (cons? V902) (and (= @s (hd V902)) (and (cons? (tl V902)) (and (cons? (tl (tl V902))) (cons? (tl (tl (tl V902)))))))) (cons @s (cons (hd (tl V902)) (cons (shen.@s-macro (cons @s (tl (tl V902)))) ())))) ((and (cons? V902) (and (= @s (hd V902)) (and (cons? (tl V902)) (and (cons? (tl (tl V902))) (and (= () (tl (tl (tl V902)))) (string? (hd (tl V902)))))))) (let E (explode (hd (tl V902))) (if (> (length E) 1) (shen.@s-macro (cons @s (append E (tl (tl V902))))) V902))) (true V902)))
|
95
95
|
|
96
|
-
(defun shen.synonyms-macro (
|
96
|
+
(defun shen.synonyms-macro (V903) (cond ((and (cons? V903) (= synonyms (hd V903))) (cons shen.synonyms-help (cons (shen.rcons_form (shen.curry-synonyms (tl V903))) ()))) (true V903)))
|
97
97
|
|
98
|
-
(defun shen.
|
98
|
+
(defun shen.curry-synonyms (V904) (map (lambda X881 (shen.curry-type X881)) V904))
|
99
99
|
|
100
|
-
(defun shen.
|
100
|
+
(defun shen.nl-macro (V905) (cond ((and (cons? V905) (and (= nl (hd V905)) (= () (tl V905)))) (cons nl (cons 1 ()))) (true V905)))
|
101
101
|
|
102
|
-
(defun shen.
|
102
|
+
(defun shen.assoc-macro (V906) (cond ((and (cons? V906) (and (cons? (tl V906)) (and (cons? (tl (tl V906))) (and (cons? (tl (tl (tl V906)))) (element? (hd V906) (cons @p (cons @v (cons append (cons and (cons or (cons + (cons * (cons do ()))))))))))))) (cons (hd V906) (cons (hd (tl V906)) (cons (shen.assoc-macro (cons (hd V906) (tl (tl V906)))) ())))) (true V906)))
|
103
103
|
|
104
|
-
(defun shen.
|
104
|
+
(defun shen.let-macro (V907) (cond ((and (cons? V907) (and (= let (hd V907)) (and (cons? (tl V907)) (and (cons? (tl (tl V907))) (and (cons? (tl (tl (tl V907)))) (cons? (tl (tl (tl (tl V907)))))))))) (cons let (cons (hd (tl V907)) (cons (hd (tl (tl V907))) (cons (shen.let-macro (cons let (tl (tl (tl V907))))) ()))))) (true V907)))
|
105
105
|
|
106
|
-
(defun shen.
|
107
|
-
")) (true V896)))
|
106
|
+
(defun shen.abs-macro (V908) (cond ((and (cons? V908) (and (= /. (hd V908)) (and (cons? (tl V908)) (and (cons? (tl (tl V908))) (cons? (tl (tl (tl V908)))))))) (cons lambda (cons (hd (tl V908)) (cons (shen.abs-macro (cons /. (tl (tl V908)))) ())))) ((and (cons? V908) (and (= /. (hd V908)) (and (cons? (tl V908)) (and (cons? (tl (tl V908))) (= () (tl (tl (tl V908)))))))) (cons lambda (tl V908))) (true V908)))
|
108
107
|
|
109
|
-
(defun shen.
|
108
|
+
(defun shen.cases-macro (V911) (cond ((and (cons? V911) (and (= cases (hd V911)) (and (cons? (tl V911)) (and (= true (hd (tl V911))) (cons? (tl (tl V911))))))) (hd (tl (tl V911)))) ((and (cons? V911) (and (= cases (hd V911)) (and (cons? (tl V911)) (and (cons? (tl (tl V911))) (= () (tl (tl (tl V911)))))))) (cons if (cons (hd (tl V911)) (cons (hd (tl (tl V911))) (cons (cons simple-error (cons "error: cases exhausted" ())) ()))))) ((and (cons? V911) (and (= cases (hd V911)) (and (cons? (tl V911)) (cons? (tl (tl V911)))))) (cons if (cons (hd (tl V911)) (cons (hd (tl (tl V911))) (cons (shen.cases-macro (cons cases (tl (tl (tl V911))))) ()))))) ((and (cons? V911) (and (= cases (hd V911)) (and (cons? (tl V911)) (= () (tl (tl V911)))))) (simple-error "error: odd number of case elements
|
109
|
+
")) (true V911)))
|
110
|
+
|
111
|
+
(defun shen.timer-macro (V912) (cond ((and (cons? V912) (and (= time (hd V912)) (and (cons? (tl V912)) (= () (tl (tl V912)))))) (shen.let-macro (cons let (cons Start (cons (cons get-time (cons run ())) (cons Result (cons (hd (tl V912)) (cons Finish (cons (cons get-time (cons run ())) (cons Time (cons (cons - (cons Finish (cons Start ()))) (cons Message (cons (cons shen.prhush (cons (cons cn (cons "
|
110
112
|
run time: " (cons (cons cn (cons (cons str (cons Time ())) (cons " secs
|
111
|
-
" ()))) ()))) (cons (cons stoutput ()) ()))) (cons Result ())))))))))))))) (true
|
113
|
+
" ()))) ()))) (cons (cons stoutput ()) ()))) (cons Result ())))))))))))))) (true V912)))
|
112
114
|
|
113
|
-
(defun shen.tuple-up (
|
115
|
+
(defun shen.tuple-up (V913) (cond ((cons? V913) (cons @p (cons (hd V913) (cons (shen.tuple-up (tl V913)) ())))) (true V913)))
|
114
116
|
|
115
|
-
(defun shen.put/get-macro (
|
117
|
+
(defun shen.put/get-macro (V914) (cond ((and (cons? V914) (and (= put (hd V914)) (and (cons? (tl V914)) (and (cons? (tl (tl V914))) (and (cons? (tl (tl (tl V914)))) (= () (tl (tl (tl (tl V914)))))))))) (cons put (cons (hd (tl V914)) (cons (hd (tl (tl V914))) (cons (hd (tl (tl (tl V914)))) (cons (cons value (cons *property-vector* ())) ())))))) ((and (cons? V914) (and (= get (hd V914)) (and (cons? (tl V914)) (and (cons? (tl (tl V914))) (= () (tl (tl (tl V914)))))))) (cons get (cons (hd (tl V914)) (cons (hd (tl (tl V914))) (cons (cons value (cons *property-vector* ())) ()))))) (true V914)))
|
116
118
|
|
117
|
-
(defun shen.function-macro (
|
119
|
+
(defun shen.function-macro (V915) (cond ((and (cons? V915) (and (= function (hd V915)) (and (cons? (tl V915)) (= () (tl (tl V915)))))) (shen.function-abstraction (hd (tl V915)) (arity (hd (tl V915))))) (true V915)))
|
118
120
|
|
119
|
-
(defun shen.function-abstraction (
|
121
|
+
(defun shen.function-abstraction (V916 V917) (cond ((= 0 V917) (cons freeze (cons V916 ()))) ((= -1 V917) V916) (true (shen.function-abstraction-help V916 V917 ()))))
|
120
122
|
|
121
|
-
(defun shen.function-abstraction-help (
|
123
|
+
(defun shen.function-abstraction-help (V918 V919 V920) (cond ((= 0 V919) (cons V918 V920)) (true (let X (gensym V) (cons /. (cons X (cons (shen.function-abstraction-help V918 (- V919 1) (append V920 (cons X ()))) ())))))))
|
122
124
|
|
123
|
-
(defun undefmacro (
|
125
|
+
(defun undefmacro (V921) (do (set *macros* (remove V921 (value *macros*))) V921))
|
124
126
|
|
125
127
|
|
126
128
|
|