myco 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/myco/bootstrap.my.rb +6 -15
- data/lib/myco/command/inoculate.my.rb +71 -122
- data/lib/myco/command.my.rb +26 -69
- data/lib/myco/core/BasicDecorators.my.rb +65 -126
- data/lib/myco/core/BasicObject.my.rb +19 -42
- data/lib/myco/core/Category.my.rb +9 -18
- data/lib/myco/core/Decorator.my.rb +32 -51
- data/lib/myco/core/FileToplevel.my.rb +20 -41
- data/lib/myco/core/Object.my.rb +24 -53
- data/lib/myco/core/Switch.my.rb +52 -73
- data/lib/myco/parser/ast/ToRuby.my +1 -1
- data/lib/myco/parser/ast/ToRuby.my.rb +375 -566
- data/lib/myco/tools/BasicCommand.my.rb +55 -78
- data/lib/myco/tools/mycompile.my.rb +53 -112
- data/lib/myco/version.rb +1 -1
- metadata +13 -14
@@ -1,18 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
self.parent.send(
|
11
|
-
sym,
|
12
|
-
*a,
|
13
|
-
&b
|
14
|
-
)
|
15
|
-
)}
|
16
|
-
)}}
|
17
|
-
.tap { |__c__| __c__.__name__ = :Category }
|
18
|
-
)}}.instance
|
1
|
+
|
2
|
+
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco::Category = ::Myco::Component.new([::Myco::EmptyObject], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(declare_meme(:method_missing, [], nil, ::Myco.cscope.dup) { |sym, *a, &b| (self.parent.send(
|
5
|
+
sym,
|
6
|
+
*a,
|
7
|
+
&b
|
8
|
+
))})}}
|
9
|
+
.tap { |__c__| __c__.__name__ = :Category })}}.instance
|
@@ -1,52 +1,33 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
1
|
+
|
2
|
+
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco::Decorator = ::Myco::Component.new([::Myco::BasicObject], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
)
|
35
|
-
)}
|
36
|
-
(self.respond_to?(:var).false? ? ::Myco::Void : self.var(meme)).tap { |x| (
|
37
|
-
meme.__send__(
|
38
|
-
:var=,
|
39
|
-
x
|
40
|
-
)
|
41
|
-
)}
|
42
|
-
(self.respond_to?(:expose).false? ? ::Myco::Void : self.expose(meme)).tap { |x| (
|
43
|
-
meme.__send__(
|
44
|
-
:expose=,
|
45
|
-
x
|
46
|
-
)
|
47
|
-
)}
|
48
|
-
)}
|
49
|
-
)}
|
50
|
-
)}}
|
51
|
-
.tap { |__c__| __c__.__name__ = :Decorator }
|
52
|
-
)}}.instance
|
5
|
+
declare_meme(:apply, [], nil, ::Myco.cscope.dup) { |meme, *args| nil}
|
6
|
+
__category__(:transforms).component_eval {(declare_meme(:apply, [], nil, ::Myco.cscope.dup) { |meme, *args| (
|
7
|
+
(self.respond_to?(:target).false? ? ::Myco::Void : self.target(meme)).tap { |x| (meme.__send__(
|
8
|
+
:target=,
|
9
|
+
x
|
10
|
+
))}
|
11
|
+
(self.respond_to?(:name).false? ? ::Myco::Void : self.name(meme)).tap { |x| (meme.__send__(
|
12
|
+
:name=,
|
13
|
+
x
|
14
|
+
))}
|
15
|
+
(self.respond_to?(:body).false? ? ::Myco::Void : self.body(meme)).tap { |x| (meme.__send__(
|
16
|
+
:body=,
|
17
|
+
x
|
18
|
+
))}
|
19
|
+
(self.respond_to?(:cache).false? ? ::Myco::Void : self.cache(meme)).tap { |x| (meme.__send__(
|
20
|
+
:cache=,
|
21
|
+
x
|
22
|
+
))}
|
23
|
+
(self.respond_to?(:var).false? ? ::Myco::Void : self.var(meme)).tap { |x| (meme.__send__(
|
24
|
+
:var=,
|
25
|
+
x
|
26
|
+
))}
|
27
|
+
(self.respond_to?(:expose).false? ? ::Myco::Void : self.expose(meme)).tap { |x| (meme.__send__(
|
28
|
+
:expose=,
|
29
|
+
x
|
30
|
+
))}
|
31
|
+
)})}
|
32
|
+
)}}
|
33
|
+
.tap { |__c__| __c__.__name__ = :Decorator })}}.instance
|
@@ -1,42 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
1
|
+
|
2
|
+
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco::FileToplevel = ::Myco::Component.new([::Myco::Object], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
|
-
|
6
|
-
|
7
|
-
], ::Myco.cscope.
|
8
|
-
.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
)
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
23
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
24
|
-
declare_meme(:apply, [], nil, ::Myco.cscope.dup) { |meme, *args| (
|
25
|
-
load_paths = [
|
26
|
-
meme.target.instance.dirname
|
27
|
-
]
|
28
|
-
scope = meme.target.constant_scope
|
29
|
-
component = ::Myco.find_constant(:Myco).eval_file(
|
30
|
-
meme.name.to_s,
|
31
|
-
load_paths,
|
32
|
-
false,
|
33
|
-
scope
|
34
|
-
)
|
35
|
-
meme.target.include(component)
|
36
|
-
)}
|
37
|
-
)}}.instance
|
38
|
-
)}
|
39
|
-
)}
|
40
|
-
)}}
|
41
|
-
.tap { |__c__| __c__.__name__ = :FileToplevel }
|
42
|
-
)}}.instance
|
5
|
+
declare_meme(:dirname, [], nil, ::Myco.cscope.dup) { |*| (self.component.instance_variable_get("@dirname"))}
|
6
|
+
declare_meme(:basename, [], nil, ::Myco.cscope.dup) { |*| (self.component.instance_variable_get("@basename"))}
|
7
|
+
declare_meme(:filename, [], nil, ::Myco.cscope.dup) { |*| (self.component.instance_variable_get("@filename"))}
|
8
|
+
__category__(:decorators).component_eval {(declare_meme(:import, [], nil, ::Myco.cscope.dup) { |*| (::Myco::Component.new([::Myco.find_constant(:Decorator)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
9
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(declare_meme(:apply, [], nil, ::Myco.cscope.dup) { |meme, *args| (
|
10
|
+
load_paths = [meme.target.instance.dirname]
|
11
|
+
scope = meme.target.constant_scope
|
12
|
+
component = ::Myco.find_constant(:Myco).eval_file(
|
13
|
+
meme.name.to_s,
|
14
|
+
load_paths,
|
15
|
+
false,
|
16
|
+
scope
|
17
|
+
)
|
18
|
+
meme.target.include(component)
|
19
|
+
)})}}.instance)})}
|
20
|
+
)}}
|
21
|
+
.tap { |__c__| __c__.__name__ = :FileToplevel })}}.instance
|
data/lib/myco/core/Object.my.rb
CHANGED
@@ -1,55 +1,26 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
1
|
+
|
2
|
+
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco::Object = ::Myco::Component.new([::Myco::BasicObject], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
|
-
::Myco
|
6
|
-
|
7
|
-
|
5
|
+
declare_meme(:__signal__, [], nil, ::Myco.cscope.dup) { |name, *args, &block| (self.component.ancestors.reverse.each { |other| (::Myco.branch_op(:"&&", other.__send__(
|
6
|
+
:is_a?,
|
7
|
+
::Myco.find_constant(:Component)
|
8
|
+
)) {(
|
9
|
+
inst = ::Myco.branch_op(:"??", ::Myco.branch_op(:"&?", self.component.__send__(
|
10
|
+
:==,
|
11
|
+
other
|
12
|
+
)) {self}) {other.instance}
|
13
|
+
(((inst.respond_to?(:decorators).false? ? ::Myco::Void : inst.decorators).respond_to?(:on).false? ? ::Myco::Void : (inst.respond_to?(:decorators).false? ? ::Myco::Void : inst.decorators).on).respond_to?(:signal_handlers).false? ? ::Myco::Void : ((inst.respond_to?(:decorators).false? ? ::Myco::Void : inst.decorators).respond_to?(:on).false? ? ::Myco::Void : (inst.respond_to?(:decorators).false? ? ::Myco::Void : inst.decorators).on).signal_handlers(name)).each { |meme| (meme.result_for(
|
14
|
+
self,
|
15
|
+
*args,
|
16
|
+
&block
|
17
|
+
))}
|
18
|
+
)})})}
|
19
|
+
__category__(:decorators).component_eval {(declare_meme(:on, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (::Myco::Component.new([::Myco.find_constant(:Decorator)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
8
20
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
9
|
-
declare_meme(:
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
inst = ::Myco.branch_op(:"??", ::Myco.branch_op(:"&?", self.component.__send__(
|
16
|
-
:==,
|
17
|
-
other
|
18
|
-
)) {self}) {other.instance}
|
19
|
-
(((inst.respond_to?(:decorators).false? ? ::Myco::Void : inst.decorators).respond_to?(:on).false? ? ::Myco::Void : (inst.respond_to?(:decorators).false? ? ::Myco::Void : inst.decorators).on).respond_to?(:signal_handlers).false? ? ::Myco::Void : ((inst.respond_to?(:decorators).false? ? ::Myco::Void : inst.decorators).respond_to?(:on).false? ? ::Myco::Void : (inst.respond_to?(:decorators).false? ? ::Myco::Void : inst.decorators).on).signal_handlers(name)).each { |meme| (
|
20
|
-
meme.result_for(
|
21
|
-
self,
|
22
|
-
*args,
|
23
|
-
&block
|
24
|
-
)
|
25
|
-
)}
|
26
|
-
)}
|
27
|
-
)}
|
28
|
-
)}
|
29
|
-
__category__(:decorators).component_eval {(
|
30
|
-
declare_meme(:on, [
|
31
|
-
[:var, []]
|
32
|
-
], nil, ::Myco.cscope.dup) { |*| (
|
33
|
-
::Myco::Component.new([
|
34
|
-
::Myco.find_constant(:Decorator)
|
35
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
36
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
37
|
-
declare_meme(:signal_handlers, [
|
38
|
-
[:storage, []]
|
39
|
-
], nil, ::Myco.cscope.dup) { |*| (
|
40
|
-
::Myco.find_constant(:Array).new
|
41
|
-
)}
|
42
|
-
declare_meme(:apply, [], nil, ::Myco.cscope.dup) { |meme| (
|
43
|
-
self.signal_handlers(meme.name).push(meme)
|
44
|
-
)}
|
45
|
-
__category__(:transforms).component_eval {(
|
46
|
-
declare_meme(:expose, [], nil, ::Myco.cscope.dup) { |*| (
|
47
|
-
false
|
48
|
-
)}
|
49
|
-
)}
|
50
|
-
)}}.instance
|
51
|
-
)}
|
52
|
-
)}
|
53
|
-
)}}
|
54
|
-
.tap { |__c__| __c__.__name__ = :Object }
|
55
|
-
)}}.instance
|
21
|
+
declare_meme(:signal_handlers, [[:storage, []]], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:Array).new)}
|
22
|
+
declare_meme(:apply, [], nil, ::Myco.cscope.dup) { |meme| (self.signal_handlers(meme.name).push(meme))}
|
23
|
+
__category__(:transforms).component_eval {(declare_meme(:expose, [], nil, ::Myco.cscope.dup) { |*| (false)})}
|
24
|
+
)}}.instance)})}
|
25
|
+
)}}
|
26
|
+
.tap { |__c__| __c__.__name__ = :Object })}}.instance
|
data/lib/myco/core/Switch.my.rb
CHANGED
@@ -1,74 +1,53 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
1
|
+
|
2
|
+
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco::Switch = ::Myco::Component.new([::Myco::Object], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
|
-
::Myco
|
6
|
-
|
7
|
-
], ::Myco.cscope.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
)
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
:matched=,
|
55
|
-
true
|
56
|
-
)) {self.__send__(
|
57
|
-
:output=,
|
58
|
-
blk.call(self.input)
|
59
|
-
)}}}
|
60
|
-
self
|
61
|
-
)}
|
62
|
-
declare_meme(:else, [], nil, ::Myco.cscope.dup) { |&blk| (
|
63
|
-
::Myco.branch_op(:"||", self.matched) {::Myco.branch_op(:"&&", self.__send__(
|
64
|
-
:matched=,
|
65
|
-
true
|
66
|
-
)) {self.__send__(
|
67
|
-
:output=,
|
68
|
-
blk.call(self.input)
|
69
|
-
)}}
|
70
|
-
self
|
71
|
-
)}
|
72
|
-
)}}
|
73
|
-
.tap { |__c__| __c__.__name__ = :Switch }
|
74
|
-
)}}.instance
|
5
|
+
declare_meme(:input, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (::Myco::Void)}
|
6
|
+
declare_meme(:output, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (::Myco::Void)}
|
7
|
+
declare_meme(:matched, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (false)}
|
8
|
+
declare_meme(:comparator, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (:==)}
|
9
|
+
declare_meme(:when, [], nil, ::Myco.cscope.dup) { |expected, &blk| (
|
10
|
+
::Myco.branch_op(:"||", self.matched) {::Myco.branch_op(:"&&", self.input.send(
|
11
|
+
self.comparator,
|
12
|
+
expected
|
13
|
+
)) {::Myco.branch_op(:"&&", self.__send__(
|
14
|
+
:matched=,
|
15
|
+
true
|
16
|
+
)) {self.__send__(
|
17
|
+
:output=,
|
18
|
+
blk.call(self.input)
|
19
|
+
)}}}
|
20
|
+
self
|
21
|
+
)}
|
22
|
+
declare_meme(:when_true, [], nil, ::Myco.cscope.dup) { |&blk| (
|
23
|
+
::Myco.branch_op(:"||", self.matched) {::Myco.branch_op(:"&&", self.input) {::Myco.branch_op(:"&&", self.__send__(
|
24
|
+
:matched=,
|
25
|
+
true
|
26
|
+
)) {self.__send__(
|
27
|
+
:output=,
|
28
|
+
blk.call(self.input)
|
29
|
+
)}}}
|
30
|
+
self
|
31
|
+
)}
|
32
|
+
declare_meme(:when_false, [], nil, ::Myco.cscope.dup) { |&blk| (
|
33
|
+
::Myco.branch_op(:"||", self.matched) {::Myco.branch_op(:"||", self.input) {::Myco.branch_op(:"&&", self.__send__(
|
34
|
+
:matched=,
|
35
|
+
true
|
36
|
+
)) {self.__send__(
|
37
|
+
:output=,
|
38
|
+
blk.call(self.input)
|
39
|
+
)}}}
|
40
|
+
self
|
41
|
+
)}
|
42
|
+
declare_meme(:else, [], nil, ::Myco.cscope.dup) { |&blk| (
|
43
|
+
::Myco.branch_op(:"||", self.matched) {::Myco.branch_op(:"&&", self.__send__(
|
44
|
+
:matched=,
|
45
|
+
true
|
46
|
+
)) {self.__send__(
|
47
|
+
:output=,
|
48
|
+
blk.call(self.input)
|
49
|
+
)}}
|
50
|
+
self
|
51
|
+
)}
|
52
|
+
)}}
|
53
|
+
.tap { |__c__| __c__.__name__ = :Switch })}}.instance
|
@@ -196,7 +196,7 @@ CodeTools::AST << {
|
|
196
196
|
}
|
197
197
|
|
198
198
|
EvalExpression << { to_ruby: |g| g.add(self.body) }
|
199
|
-
DeclareFile << { to_ruby: |g| implementation.to_ruby(g) }
|
199
|
+
DeclareFile << { to_ruby: |g| g.line; implementation.to_ruby(g); g.line }
|
200
200
|
|
201
201
|
DeclareObject << {
|
202
202
|
to_ruby: |g| {
|