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,84 +1,61 @@
|
|
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.cscope.for_method_definition.const_set(:BasicCommand, ::Myco::Component.new([::Myco.find_constant(: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
|
-
declare_meme(:width, [], nil, ::Myco.cscope.dup) { |*| (
|
13
|
-
30
|
5
|
+
declare_meme(:banner, [], nil, ::Myco.cscope.dup) { |*| ("")}
|
6
|
+
declare_meme(:width, [], nil, ::Myco.cscope.dup) { |*| (30)}
|
7
|
+
declare_meme(:options_config, [], nil, ::Myco.cscope.dup) { |*| (nil)}
|
8
|
+
declare_meme(:options_parse, [], nil, ::Myco.cscope.dup) { |*argv| (
|
9
|
+
command = ::Myco.branch_op(:"&&", argv.first) {self.commands.memes.__send__(
|
10
|
+
:[],
|
11
|
+
argv.first.to_sym
|
14
12
|
)}
|
15
|
-
|
13
|
+
::Myco.branch_op(:"??", ::Myco.branch_op(:"&?", command) {(
|
14
|
+
command.result.run(*argv.slice(::Range.new(
|
15
|
+
1,
|
16
|
+
-1
|
17
|
+
)))
|
16
18
|
nil
|
17
|
-
)}
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
19
|
+
)}) {self.options_parser.parse(argv)}
|
20
|
+
)}
|
21
|
+
declare_meme(:options_parser, [], nil, ::Myco.cscope.dup) { |*| (
|
22
|
+
parser = ::Myco.find_constant(:Rubinius)::Options.new(
|
23
|
+
self.banner,
|
24
|
+
self.width,
|
25
|
+
self.options_config
|
26
|
+
)
|
27
|
+
self.options.memes.each { |name, meme| (meme.result.register_in_parser(
|
28
|
+
parser,
|
29
|
+
name
|
30
|
+
))}
|
31
|
+
parser.help
|
32
|
+
parser
|
33
|
+
)}
|
34
|
+
declare_meme(:show_help, [], nil, ::Myco.cscope.dup) { |*| (self.puts(self.options_parser.to_s))}
|
35
|
+
::Myco.cscope.for_method_definition.const_set(:Option, ::Myco::Component.new([::Myco.find_constant(:Object)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
36
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
37
|
+
declare_meme(:parser, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
38
|
+
declare_meme(:register_in_parser, [], nil, ::Myco.cscope.dup) { |parser, name| (
|
39
|
+
self.__send__(
|
40
|
+
:parser=,
|
41
|
+
parser
|
36
42
|
)
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
43
|
+
args = [
|
44
|
+
name,
|
45
|
+
::Myco.branch_op(:"??", (self.respond_to?(:argument).false? ? ::Myco::Void : self.argument)) {nil},
|
46
|
+
self.long_form,
|
47
|
+
self.description
|
48
|
+
]
|
49
|
+
args = args.compact
|
50
|
+
args = args.map { |arg| (arg.to_s)}
|
51
|
+
parser.on(*args) { |arg| (self.__send__(
|
52
|
+
:do,
|
53
|
+
arg
|
54
|
+
))}
|
48
55
|
)}
|
49
|
-
::Myco.cscope.for_method_definition.const_set(:Option, ::Myco::Component.new([
|
50
|
-
::Myco.find_constant(:Object)
|
51
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
52
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
53
|
-
declare_meme(:parser, [
|
54
|
-
[:var, []]
|
55
|
-
], nil, ::Myco.cscope.dup) { |*| nil}
|
56
|
-
declare_meme(:register_in_parser, [], nil, ::Myco.cscope.dup) { |parser, name| (
|
57
|
-
self.__send__(
|
58
|
-
:parser=,
|
59
|
-
parser
|
60
|
-
)
|
61
|
-
args = [
|
62
|
-
name,
|
63
|
-
::Myco.branch_op(:"??", (self.respond_to?(:argument).false? ? ::Myco::Void : self.argument)) {nil},
|
64
|
-
self.long_form,
|
65
|
-
self.description
|
66
|
-
]
|
67
|
-
args = args.compact
|
68
|
-
args = args.map { |arg| (
|
69
|
-
arg.to_s
|
70
|
-
)}
|
71
|
-
parser.on(*args) { |arg| (
|
72
|
-
self.__send__(
|
73
|
-
:do,
|
74
|
-
arg
|
75
|
-
)
|
76
|
-
)}
|
77
|
-
)}
|
78
|
-
)}})
|
79
|
-
.tap { |__c__| __c__.__name__ = :Option }
|
80
|
-
__category__(:options).component_eval {nil}
|
81
|
-
__category__(:commands).component_eval {nil}
|
82
56
|
)}})
|
83
|
-
.tap { |__c__| __c__.__name__ = :
|
84
|
-
)}
|
57
|
+
.tap { |__c__| __c__.__name__ = :Option }
|
58
|
+
__category__(:options).component_eval {nil}
|
59
|
+
__category__(:commands).component_eval {nil}
|
60
|
+
)}})
|
61
|
+
.tap { |__c__| __c__.__name__ = :BasicCommand })}}.instance
|
@@ -1,113 +1,56 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
1
|
+
|
2
|
+
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
3
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
|
-
declare_meme(:"OptionParser.my", [
|
6
|
-
|
7
|
-
], nil, ::Myco.cscope.dup) { |*| nil}
|
8
|
-
::Myco::Component.new([
|
9
|
-
::Myco.find_constant(:Object)
|
10
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
|
+
declare_meme(:"OptionParser.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
5
|
+
::Myco::Component.new([::Myco.find_constant(:Object)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
11
6
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
12
|
-
declare_meme(:options, [
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
::Myco.find_constant(:
|
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
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
::Myco.find_constant(:Myco)::ToolSet::Compiler::SexpPrinter,
|
60
|
-
:print_ast
|
61
|
-
)
|
62
|
-
)}
|
63
|
-
)}}.instance
|
64
|
-
)}
|
65
|
-
declare_meme(:"-B", [], nil, ::Myco.cscope.dup) { |*| (
|
66
|
-
::Myco::Component.new([
|
67
|
-
::Myco.find_constant(:Option)
|
68
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
69
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
70
|
-
declare_meme(:description, [], nil, ::Myco.cscope.dup) { |*| (
|
71
|
-
"Print bytecode for compiled methods"
|
72
|
-
)}
|
73
|
-
declare_meme(:long_form, [], nil, ::Myco.cscope.dup) { |*| (
|
74
|
-
"--print-bytecode"
|
75
|
-
)}
|
76
|
-
declare_meme(:do, [], nil, ::Myco.cscope.dup) { |*| (
|
77
|
-
self.__send__(
|
78
|
-
:results=,
|
79
|
-
true,
|
80
|
-
:print_bytecode
|
81
|
-
)
|
82
|
-
)}
|
83
|
-
)}}.instance
|
84
|
-
)}
|
85
|
-
declare_meme(:"-e", [], nil, ::Myco.cscope.dup) { |*| (
|
86
|
-
::Myco::Component.new([
|
87
|
-
::Myco.find_constant(:Option)
|
88
|
-
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
89
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
90
|
-
declare_meme(:argument, [], nil, ::Myco.cscope.dup) { |*| (
|
91
|
-
"STRING"
|
92
|
-
)}
|
93
|
-
declare_meme(:description, [], nil, ::Myco.cscope.dup) { |*| (
|
94
|
-
"Compile STRING"
|
95
|
-
)}
|
96
|
-
declare_meme(:long_form, [], nil, ::Myco.cscope.dup) { |*| (
|
97
|
-
"--evaluate"
|
98
|
-
)}
|
99
|
-
declare_meme(:do, [], nil, ::Myco.cscope.dup) { |arg| (
|
100
|
-
self.__send__(
|
101
|
-
:results=,
|
102
|
-
arg,
|
103
|
-
:string
|
104
|
-
)
|
105
|
-
)}
|
106
|
-
)}}.instance
|
107
|
-
)}
|
108
|
-
)}
|
109
|
-
)}}.instance
|
110
|
-
)}
|
7
|
+
declare_meme(:options, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (::Myco::Component.new([::Myco.find_constant(:OptionParser)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
8
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
9
|
+
declare_meme(:results, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (nil)}
|
10
|
+
__category__(:options).component_eval {(
|
11
|
+
declare_meme(:"-A", [], nil, ::Myco.cscope.dup) { |*| (::Myco::Component.new([::Myco.find_constant(:Option)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
12
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
13
|
+
declare_meme(:description, [], nil, ::Myco.cscope.dup) { |*| ("Print an ascii graph of the AST")}
|
14
|
+
declare_meme(:long_form, [], nil, ::Myco.cscope.dup) { |*| ("--print-ast")}
|
15
|
+
declare_meme(:do, [], nil, ::Myco.cscope.dup) { |*| (self.__send__(
|
16
|
+
:results=,
|
17
|
+
::Myco.find_constant(:Myco)::ToolSet::Compiler::ASTPrinter,
|
18
|
+
:print_ast
|
19
|
+
))}
|
20
|
+
)}}.instance)}
|
21
|
+
declare_meme(:"-S", [], nil, ::Myco.cscope.dup) { |*| (::Myco::Component.new([::Myco.find_constant(:Option)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
22
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
23
|
+
declare_meme(:description, [], nil, ::Myco.cscope.dup) { |*| ("Print the AST as an S-expression")}
|
24
|
+
declare_meme(:long_form, [], nil, ::Myco.cscope.dup) { |*| ("--print-sexp")}
|
25
|
+
declare_meme(:do, [], nil, ::Myco.cscope.dup) { |*| (self.__send__(
|
26
|
+
:results=,
|
27
|
+
::Myco.find_constant(:Myco)::ToolSet::Compiler::SexpPrinter,
|
28
|
+
:print_ast
|
29
|
+
))}
|
30
|
+
)}}.instance)}
|
31
|
+
declare_meme(:"-B", [], nil, ::Myco.cscope.dup) { |*| (::Myco::Component.new([::Myco.find_constant(:Option)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
32
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
33
|
+
declare_meme(:description, [], nil, ::Myco.cscope.dup) { |*| ("Print bytecode for compiled methods")}
|
34
|
+
declare_meme(:long_form, [], nil, ::Myco.cscope.dup) { |*| ("--print-bytecode")}
|
35
|
+
declare_meme(:do, [], nil, ::Myco.cscope.dup) { |*| (self.__send__(
|
36
|
+
:results=,
|
37
|
+
true,
|
38
|
+
:print_bytecode
|
39
|
+
))}
|
40
|
+
)}}.instance)}
|
41
|
+
declare_meme(:"-e", [], nil, ::Myco.cscope.dup) { |*| (::Myco::Component.new([::Myco.find_constant(:Option)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
42
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
43
|
+
declare_meme(:argument, [], nil, ::Myco.cscope.dup) { |*| ("STRING")}
|
44
|
+
declare_meme(:description, [], nil, ::Myco.cscope.dup) { |*| ("Compile STRING")}
|
45
|
+
declare_meme(:long_form, [], nil, ::Myco.cscope.dup) { |*| ("--evaluate")}
|
46
|
+
declare_meme(:do, [], nil, ::Myco.cscope.dup) { |arg| (self.__send__(
|
47
|
+
:results=,
|
48
|
+
arg,
|
49
|
+
:string
|
50
|
+
))}
|
51
|
+
)}}.instance)}
|
52
|
+
)}
|
53
|
+
)}}.instance)}
|
111
54
|
declare_meme(:run, [], nil, ::Myco.cscope.dup) { |*argv| (
|
112
55
|
self.options.parse(argv)
|
113
56
|
print_ast = ::Myco.branch_op(:"||", self.options.results(:print_ast)) {false}
|
@@ -127,10 +70,8 @@
|
|
127
70
|
self.__send__(
|
128
71
|
:if,
|
129
72
|
print_ast
|
130
|
-
) { || (
|
131
|
-
compiler.parser.print(print_ast)
|
132
|
-
)}
|
73
|
+
) { || (compiler.parser.print(print_ast))}
|
133
74
|
compiler.run
|
134
75
|
)}
|
135
76
|
)}}.instance
|
136
|
-
)}}.instance
|
77
|
+
)}}.instance
|
data/lib/myco/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myco
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joe McIlvain
|
@@ -11,7 +11,6 @@ cert_chain: []
|
|
11
11
|
date: 2015-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
type: :runtime
|
15
14
|
version_requirements: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - "~>"
|
@@ -24,8 +23,8 @@ dependencies:
|
|
24
23
|
- - "~>"
|
25
24
|
- !ruby/object:Gem::Version
|
26
25
|
version: '2.3'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
26
|
type: :runtime
|
27
|
+
- !ruby/object:Gem::Dependency
|
29
28
|
version_requirements: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - "~>"
|
@@ -38,8 +37,8 @@ dependencies:
|
|
38
37
|
- - "~>"
|
39
38
|
- !ruby/object:Gem::Version
|
40
39
|
version: '2.2'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
40
|
type: :runtime
|
41
|
+
- !ruby/object:Gem::Dependency
|
43
42
|
version_requirements: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
44
|
- - "~>"
|
@@ -52,8 +51,8 @@ dependencies:
|
|
52
51
|
- - "~>"
|
53
52
|
- !ruby/object:Gem::Version
|
54
53
|
version: '2.2'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
54
|
type: :runtime
|
55
|
+
- !ruby/object:Gem::Dependency
|
57
56
|
version_requirements: !ruby/object:Gem::Requirement
|
58
57
|
requirements:
|
59
58
|
- - "~>"
|
@@ -66,8 +65,8 @@ dependencies:
|
|
66
65
|
- - "~>"
|
67
66
|
- !ruby/object:Gem::Version
|
68
67
|
version: '2.2'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
68
|
type: :runtime
|
69
|
+
- !ruby/object:Gem::Dependency
|
71
70
|
version_requirements: !ruby/object:Gem::Requirement
|
72
71
|
requirements:
|
73
72
|
- - "~>"
|
@@ -80,8 +79,8 @@ dependencies:
|
|
80
79
|
- - "~>"
|
81
80
|
- !ruby/object:Gem::Version
|
82
81
|
version: '2.2'
|
82
|
+
type: :runtime
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
type: :development
|
85
84
|
version_requirements: !ruby/object:Gem::Requirement
|
86
85
|
requirements:
|
87
86
|
- - "~>"
|
@@ -94,8 +93,8 @@ dependencies:
|
|
94
93
|
- - "~>"
|
95
94
|
- !ruby/object:Gem::Version
|
96
95
|
version: '1.0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
96
|
type: :development
|
97
|
+
- !ruby/object:Gem::Dependency
|
99
98
|
version_requirements: !ruby/object:Gem::Requirement
|
100
99
|
requirements:
|
101
100
|
- - "~>"
|
@@ -108,8 +107,8 @@ dependencies:
|
|
108
107
|
- - "~>"
|
109
108
|
- !ruby/object:Gem::Version
|
110
109
|
version: '1.6'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
110
|
type: :development
|
111
|
+
- !ruby/object:Gem::Dependency
|
113
112
|
version_requirements: !ruby/object:Gem::Requirement
|
114
113
|
requirements:
|
115
114
|
- - "~>"
|
@@ -122,8 +121,8 @@ dependencies:
|
|
122
121
|
- - "~>"
|
123
122
|
- !ruby/object:Gem::Version
|
124
123
|
version: '10.3'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
124
|
type: :development
|
125
|
+
- !ruby/object:Gem::Dependency
|
127
126
|
version_requirements: !ruby/object:Gem::Requirement
|
128
127
|
requirements:
|
129
128
|
- - "~>"
|
@@ -136,8 +135,8 @@ dependencies:
|
|
136
135
|
- - "~>"
|
137
136
|
- !ruby/object:Gem::Version
|
138
137
|
version: '0.9'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
138
|
type: :development
|
139
|
+
- !ruby/object:Gem::Dependency
|
141
140
|
version_requirements: !ruby/object:Gem::Requirement
|
142
141
|
requirements:
|
143
142
|
- - "~>"
|
@@ -150,8 +149,8 @@ dependencies:
|
|
150
149
|
- - "~>"
|
151
150
|
- !ruby/object:Gem::Version
|
152
151
|
version: '1.4'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
152
|
type: :development
|
153
|
+
- !ruby/object:Gem::Dependency
|
155
154
|
version_requirements: !ruby/object:Gem::Requirement
|
156
155
|
requirements:
|
157
156
|
- - "~>"
|
@@ -164,8 +163,8 @@ dependencies:
|
|
164
163
|
- - "~>"
|
165
164
|
- !ruby/object:Gem::Version
|
166
165
|
version: '3.0'
|
167
|
-
- !ruby/object:Gem::Dependency
|
168
166
|
type: :development
|
167
|
+
- !ruby/object:Gem::Dependency
|
169
168
|
version_requirements: !ruby/object:Gem::Requirement
|
170
169
|
requirements:
|
171
170
|
- - "~>"
|
@@ -178,6 +177,7 @@ dependencies:
|
|
178
177
|
- - "~>"
|
179
178
|
- !ruby/object:Gem::Version
|
180
179
|
version: '1.3'
|
180
|
+
type: :development
|
181
181
|
description: An experimental language on the Rubinius VM
|
182
182
|
email: joe.eli.mac@gmail.com
|
183
183
|
executables:
|
@@ -274,4 +274,3 @@ signing_key:
|
|
274
274
|
specification_version: 4
|
275
275
|
summary: An experimental language on the Rubinius VM
|
276
276
|
test_files: []
|
277
|
-
has_rdoc:
|