myco 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/lib/myco/bootstrap/add_method.rb +38 -0
  3. data/lib/myco/bootstrap/component.rb +43 -21
  4. data/lib/myco/bootstrap/find_constant.rb +73 -25
  5. data/lib/myco/bootstrap/instance.rb +96 -25
  6. data/lib/myco/bootstrap/meme.rb +18 -12
  7. data/lib/myco/bootstrap/tuple.rb +13 -0
  8. data/lib/myco/bootstrap/undefined.rb +9 -0
  9. data/lib/myco/bootstrap/void.rb +5 -4
  10. data/lib/myco/bootstrap.my +24 -13
  11. data/lib/myco/bootstrap.my.rb +41 -4
  12. data/lib/myco/bootstrap.rb +4 -0
  13. data/lib/myco/code_loader.rb +11 -9
  14. data/lib/myco/code_tools/AST/Block.my.rb +2 -2
  15. data/lib/myco/code_tools/AST/ConstantAccess.my.rb +4 -4
  16. data/lib/myco/code_tools/AST/ConstantAssignment.my.rb +4 -4
  17. data/lib/myco/code_tools/AST/Invoke.my +1 -1
  18. data/lib/myco/code_tools/AST/Invoke.my.rb +1 -1
  19. data/lib/myco/code_tools/AST/Node.my +2 -4
  20. data/lib/myco/code_tools/AST/Node.my.rb +3 -3
  21. data/lib/myco/code_tools/AST/PipeOperator.my.rb +1 -1
  22. data/lib/myco/code_tools/AST/ToRuby.my.rb +8 -8
  23. data/lib/myco/code_tools/AST/misc.my.rb +1 -1
  24. data/lib/myco/code_tools/Parser.my +8 -15
  25. data/lib/myco/code_tools/Parser.my.rb +8 -14
  26. data/lib/myco/code_tools/parser/MycoBuilder.my +3 -4
  27. data/lib/myco/code_tools/parser/MycoBuilder.my.rb +5 -6
  28. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeHelpers.my +8 -4
  29. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeHelpers.my.rb +5 -5
  30. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeInstructions.my +2 -2
  31. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeInstructions.my.rb +12 -12
  32. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeParser.my +54 -44
  33. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeParser.my.rb +69 -83
  34. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Grammar.my +18 -8
  35. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Grammar.my.rb +24 -10
  36. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Machine.my.rb +1 -1
  37. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Parser.my +1 -1
  38. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Parser.my.rb +1 -2
  39. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Patterns.my +1 -1
  40. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Patterns.my.rb +1 -1
  41. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Processor.my +3 -3
  42. data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Processor.my.rb +5 -6
  43. data/lib/myco/code_tools/parser/pegleromyces/spec/BasicSpec.my +35 -0
  44. data/lib/myco/code_tools/parser/pegleromyces/spec/BasicSpec.my.rb +35 -0
  45. data/lib/myco/code_tools/parser/pegleromyces/spec/Builder.test.my +10 -0
  46. data/lib/myco/code_tools/parser/pegleromyces/spec/Builder.test.my.rb +9 -0
  47. data/lib/myco/code_tools/parser/pegleromyces/spec/BytecodeInstructions.test.my +10 -0
  48. data/lib/myco/code_tools/parser/pegleromyces/spec/BytecodeInstructions.test.my.rb +9 -0
  49. data/lib/myco/code_tools/parser/pegleromyces/spec/BytecodeParser.test.my +81 -0
  50. data/lib/myco/code_tools/parser/pegleromyces/spec/BytecodeParser.test.my.rb +209 -0
  51. data/lib/myco/code_tools/parser/pegleromyces/spec/Constructions.test.my +229 -0
  52. data/lib/myco/code_tools/parser/pegleromyces/spec/Constructions.test.my.rb +663 -0
  53. data/lib/myco/code_tools/parser/pegleromyces/spec/Grammar.test.my +10 -0
  54. data/lib/myco/code_tools/parser/pegleromyces/spec/Grammar.test.my.rb +9 -0
  55. data/lib/myco/code_tools/parser/pegleromyces/spec/Instructions.test.my +10 -0
  56. data/lib/myco/code_tools/parser/pegleromyces/spec/Instructions.test.my.rb +9 -0
  57. data/lib/myco/code_tools/parser/pegleromyces/spec/Machine.test.my +13 -0
  58. data/lib/myco/code_tools/parser/pegleromyces/spec/Machine.test.my.rb +20 -0
  59. data/lib/myco/code_tools/parser/pegleromyces/spec/Parser.test.my +54 -0
  60. data/lib/myco/code_tools/parser/pegleromyces/spec/Parser.test.my.rb +215 -0
  61. data/lib/myco/code_tools/parser/pegleromyces/spec/Patterns.test.my +156 -0
  62. data/lib/myco/code_tools/parser/pegleromyces/spec/Patterns.test.my.rb +334 -0
  63. data/lib/myco/code_tools/parser/pegleromyces/spec/Processor.test.my +10 -0
  64. data/lib/myco/code_tools/parser/pegleromyces/spec/Processor.test.my.rb +9 -0
  65. data/lib/myco/code_tools/parser/pegleromyces/spec/run.my +20 -0
  66. data/lib/myco/code_tools/parser/pegleromyces/spec/run.my.rb +16 -0
  67. data/lib/myco/core/BasicDecorators.my +19 -11
  68. data/lib/myco/core/BasicDecorators.my.rb +24 -20
  69. data/lib/myco/core/BasicObject.my +12 -7
  70. data/lib/myco/core/BasicObject.my.rb +50 -44
  71. data/lib/myco/core/Category.my +12 -2
  72. data/lib/myco/core/Category.my.rb +15 -7
  73. data/lib/myco/core/Decorator.my +1 -1
  74. data/lib/myco/core/Decorator.my.rb +8 -10
  75. data/lib/myco/core/FileToplevel.my +3 -3
  76. data/lib/myco/core/FileToplevel.my.rb +4 -6
  77. data/lib/myco/core/Object.my +7 -10
  78. data/lib/myco/core/Object.my.rb +11 -17
  79. data/lib/myco/core/Ruby.my +6 -0
  80. data/lib/myco/core/Ruby.my.rb +16 -0
  81. data/lib/myco/core/Switch.my +1 -1
  82. data/lib/myco/core/Switch.my.rb +1 -1
  83. data/lib/myco/core.my +4 -0
  84. data/lib/myco/core.my.rb +7 -0
  85. data/lib/myco/dev/call_sites.rb +39 -0
  86. data/lib/myco/dev/counter.rb +26 -0
  87. data/lib/myco/dev.rb +3 -0
  88. data/lib/myco/eval.rb +1 -1
  89. data/lib/myco/tools/BasicCommand.my.rb +1 -1
  90. data/lib/myco/version.rb +1 -1
  91. data/lib/myco.rb +2 -3
  92. metadata +53 -20
  93. data/lib/myco/bootstrap/evaluator.rb +0 -58
metadata CHANGED
@@ -1,23 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myco
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe McIlvain
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-06 00:00:00.000000000 Z
11
+ date: 2015-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rubinius-toolset
15
- type: :runtime
16
14
  version_requirements: !ruby/object:Gem::Requirement
17
15
  requirements:
18
16
  - - "~>"
19
17
  - !ruby/object:Gem::Version
20
18
  version: '2.3'
19
+ name: rubinius-toolset
20
+ type: :runtime
21
21
  prerelease: false
22
22
  requirement: !ruby/object:Gem::Requirement
23
23
  requirements:
@@ -25,13 +25,13 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.3'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rubinius-compiler
29
- type: :runtime
30
28
  version_requirements: !ruby/object:Gem::Requirement
31
29
  requirements:
32
30
  - - "~>"
33
31
  - !ruby/object:Gem::Version
34
32
  version: '2.2'
33
+ name: rubinius-compiler
34
+ type: :runtime
35
35
  prerelease: false
36
36
  requirement: !ruby/object:Gem::Requirement
37
37
  requirements:
@@ -39,13 +39,13 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '2.2'
41
41
  - !ruby/object:Gem::Dependency
42
- name: bundler
43
- type: :development
44
42
  version_requirements: !ruby/object:Gem::Requirement
45
43
  requirements:
46
44
  - - "~>"
47
45
  - !ruby/object:Gem::Version
48
46
  version: '1.6'
47
+ name: bundler
48
+ type: :development
49
49
  prerelease: false
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
@@ -53,13 +53,13 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.6'
55
55
  - !ruby/object:Gem::Dependency
56
- name: rake
57
- type: :development
58
56
  version_requirements: !ruby/object:Gem::Requirement
59
57
  requirements:
60
58
  - - "~>"
61
59
  - !ruby/object:Gem::Version
62
60
  version: '10.3'
61
+ name: rake
62
+ type: :development
63
63
  prerelease: false
64
64
  requirement: !ruby/object:Gem::Requirement
65
65
  requirements:
@@ -67,13 +67,13 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '10.3'
69
69
  - !ruby/object:Gem::Dependency
70
- name: pry
71
- type: :development
72
70
  version_requirements: !ruby/object:Gem::Requirement
73
71
  requirements:
74
72
  - - "~>"
75
73
  - !ruby/object:Gem::Version
76
74
  version: '0.9'
75
+ name: pry
76
+ type: :development
77
77
  prerelease: false
78
78
  requirement: !ruby/object:Gem::Requirement
79
79
  requirements:
@@ -81,13 +81,13 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0.9'
83
83
  - !ruby/object:Gem::Dependency
84
- name: pry-rescue
85
- type: :development
86
84
  version_requirements: !ruby/object:Gem::Requirement
87
85
  requirements:
88
86
  - - "~>"
89
87
  - !ruby/object:Gem::Version
90
88
  version: '1.4'
89
+ name: pry-rescue
90
+ type: :development
91
91
  prerelease: false
92
92
  requirement: !ruby/object:Gem::Requirement
93
93
  requirements:
@@ -95,13 +95,13 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '1.4'
97
97
  - !ruby/object:Gem::Dependency
98
- name: rspec
99
- type: :development
100
98
  version_requirements: !ruby/object:Gem::Requirement
101
99
  requirements:
102
100
  - - "~>"
103
101
  - !ruby/object:Gem::Version
104
102
  version: '3.0'
103
+ name: rspec
104
+ type: :development
105
105
  prerelease: false
106
106
  requirement: !ruby/object:Gem::Requirement
107
107
  requirements:
@@ -109,13 +109,13 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '3.0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: fivemat
113
- type: :development
114
112
  version_requirements: !ruby/object:Gem::Requirement
115
113
  requirements:
116
114
  - - "~>"
117
115
  - !ruby/object:Gem::Version
118
116
  version: '1.3'
117
+ name: fivemat
118
+ type: :development
119
119
  prerelease: false
120
120
  requirement: !ruby/object:Gem::Requirement
121
121
  requirements:
@@ -137,13 +137,15 @@ files:
137
137
  - lib/myco/bootstrap.my
138
138
  - lib/myco/bootstrap.my.rb
139
139
  - lib/myco/bootstrap.rb
140
+ - lib/myco/bootstrap/add_method.rb
140
141
  - lib/myco/bootstrap/component.rb
141
142
  - lib/myco/bootstrap/empty_object.rb
142
- - lib/myco/bootstrap/evaluator.rb
143
143
  - lib/myco/bootstrap/file_toplevel.rb
144
144
  - lib/myco/bootstrap/find_constant.rb
145
145
  - lib/myco/bootstrap/instance.rb
146
146
  - lib/myco/bootstrap/meme.rb
147
+ - lib/myco/bootstrap/tuple.rb
148
+ - lib/myco/bootstrap/undefined.rb
147
149
  - lib/myco/bootstrap/void.rb
148
150
  - lib/myco/code_loader.rb
149
151
  - lib/myco/code_tools.rb
@@ -269,10 +271,36 @@ files:
269
271
  - lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Patterns.my.rb
270
272
  - lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Processor.my
271
273
  - lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Processor.my.rb
274
+ - lib/myco/code_tools/parser/pegleromyces/spec/BasicSpec.my
275
+ - lib/myco/code_tools/parser/pegleromyces/spec/BasicSpec.my.rb
276
+ - lib/myco/code_tools/parser/pegleromyces/spec/Builder.test.my
277
+ - lib/myco/code_tools/parser/pegleromyces/spec/Builder.test.my.rb
278
+ - lib/myco/code_tools/parser/pegleromyces/spec/BytecodeInstructions.test.my
279
+ - lib/myco/code_tools/parser/pegleromyces/spec/BytecodeInstructions.test.my.rb
280
+ - lib/myco/code_tools/parser/pegleromyces/spec/BytecodeParser.test.my
281
+ - lib/myco/code_tools/parser/pegleromyces/spec/BytecodeParser.test.my.rb
282
+ - lib/myco/code_tools/parser/pegleromyces/spec/Constructions.test.my
283
+ - lib/myco/code_tools/parser/pegleromyces/spec/Constructions.test.my.rb
284
+ - lib/myco/code_tools/parser/pegleromyces/spec/Grammar.test.my
285
+ - lib/myco/code_tools/parser/pegleromyces/spec/Grammar.test.my.rb
286
+ - lib/myco/code_tools/parser/pegleromyces/spec/Instructions.test.my
287
+ - lib/myco/code_tools/parser/pegleromyces/spec/Instructions.test.my.rb
288
+ - lib/myco/code_tools/parser/pegleromyces/spec/Machine.test.my
289
+ - lib/myco/code_tools/parser/pegleromyces/spec/Machine.test.my.rb
290
+ - lib/myco/code_tools/parser/pegleromyces/spec/Parser.test.my
291
+ - lib/myco/code_tools/parser/pegleromyces/spec/Parser.test.my.rb
292
+ - lib/myco/code_tools/parser/pegleromyces/spec/Patterns.test.my
293
+ - lib/myco/code_tools/parser/pegleromyces/spec/Patterns.test.my.rb
294
+ - lib/myco/code_tools/parser/pegleromyces/spec/Processor.test.my
295
+ - lib/myco/code_tools/parser/pegleromyces/spec/Processor.test.my.rb
296
+ - lib/myco/code_tools/parser/pegleromyces/spec/run.my
297
+ - lib/myco/code_tools/parser/pegleromyces/spec/run.my.rb
272
298
  - lib/myco/command.my
273
299
  - lib/myco/command.my.rb
274
300
  - lib/myco/command/inoculate.my
275
301
  - lib/myco/command/inoculate.my.rb
302
+ - lib/myco/core.my
303
+ - lib/myco/core.my.rb
276
304
  - lib/myco/core/BasicDecorators.my
277
305
  - lib/myco/core/BasicDecorators.my.rb
278
306
  - lib/myco/core/BasicObject.my
@@ -285,8 +313,13 @@ files:
285
313
  - lib/myco/core/FileToplevel.my.rb
286
314
  - lib/myco/core/Object.my
287
315
  - lib/myco/core/Object.my.rb
316
+ - lib/myco/core/Ruby.my
317
+ - lib/myco/core/Ruby.my.rb
288
318
  - lib/myco/core/Switch.my
289
319
  - lib/myco/core/Switch.my.rb
320
+ - lib/myco/dev.rb
321
+ - lib/myco/dev/call_sites.rb
322
+ - lib/myco/dev/counter.rb
290
323
  - lib/myco/eval.rb
291
324
  - lib/myco/misc.rb
292
325
  - lib/myco/tools/BasicCommand.my
@@ -314,7 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
314
347
  version: '0'
315
348
  requirements: []
316
349
  rubyforge_project:
317
- rubygems_version: 2.4.5
350
+ rubygems_version: 2.4.6
318
351
  signing_key:
319
352
  specification_version: 4
320
353
  summary: An experimental language on the Rubinius VM
@@ -1,58 +0,0 @@
1
-
2
- module Myco
3
- class Evaluator
4
-
5
- def self.evaluate(cscope, data)
6
- type, *rest = representation
7
- __send__(:"evaluate_#{type}", *rest)
8
- end
9
-
10
- def self.evaluate_component(cscope, types, create, contents)
11
- component = ::Myco::Component.new(
12
- types.map { |data| resolve_constant(cscope, *data) },
13
- cscope.for_method_definition,
14
- cscope.active_path.to_s,
15
- line
16
- )
17
-
18
- inner_cscope = ::Rubinius::ConstantScope.new(component, cscope)
19
- component.__last__ = evaluate_contents(inner_cscope, contents)
20
-
21
- create ? component.instance : component
22
- end
23
-
24
- def self.evaluate_category(cscope, name, contents)
25
- category = cscope.for_method_definition.__category__(name)
26
-
27
- inner_cscope = ::Rubinius::ConstantScope.new(category, cscope)
28
- evaluate_contents(inner_cscope, contents)
29
- end
30
-
31
- def self.evaluate_meme(cscope, name, decorations, body)
32
- cscope.for_method_definition.declare_meme(name, decorations, &body)
33
- end
34
-
35
- def self.resolve_constant(cscope, toplevel, names)
36
- first_name, *names = names
37
- const = if toplevel
38
- case first_name
39
- when :Myco; ::Myco
40
- when :Ruby; ::Object
41
- when :Rubinius; Rubinius
42
- else; ::Myco.const_get(first_name)
43
- end
44
- else
45
- ::Myco.find_constant(first_name, cscope)
46
- end
47
-
48
- names.reduce(const) { |const, var| const.const_get(name) }
49
- end
50
-
51
- def self.evaluate_contents(cscope, contents)
52
- last = nil
53
- contents.each { |item| last = evaluate(inner_cscope, item) }
54
- last
55
- end
56
-
57
- end
58
- end