myco 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/myco/code_tools/AST/ArgumentAssembly.my.rb +4 -4
- data/lib/myco/code_tools/AST/ArrayAssembly.my.rb +4 -4
- data/lib/myco/code_tools/AST/Block.my +104 -0
- data/lib/myco/code_tools/AST/Block.my.rb +126 -0
- data/lib/myco/code_tools/AST/BlockArgument.my.rb +4 -4
- data/lib/myco/code_tools/AST/BlockLiteral.my +15 -94
- data/lib/myco/code_tools/AST/BlockLiteral.my.rb +18 -121
- data/lib/myco/code_tools/AST/BlockParameter.my.rb +4 -4
- data/lib/myco/code_tools/AST/BranchOperator.my.rb +4 -4
- data/lib/myco/code_tools/AST/ConstantAccess.my.rb +4 -4
- data/lib/myco/code_tools/AST/ConstantAssignment.my.rb +4 -4
- data/lib/myco/code_tools/AST/ConstantDefine.my.rb +4 -4
- data/lib/myco/code_tools/AST/ConstantReopen.my.rb +6 -6
- data/lib/myco/code_tools/AST/DeclareCategory.my.rb +6 -6
- data/lib/myco/code_tools/AST/DeclareDecorator.my.rb +4 -4
- data/lib/myco/code_tools/AST/DeclareFile.my.rb +6 -6
- data/lib/myco/code_tools/AST/DeclareMeme.my +3 -1
- data/lib/myco/code_tools/AST/DeclareMeme.my.rb +10 -6
- data/lib/myco/code_tools/AST/DeclareObject.my.rb +6 -6
- data/lib/myco/code_tools/AST/DeclareString.my.rb +4 -4
- data/lib/myco/code_tools/AST/DynamicString.my.rb +4 -4
- data/lib/myco/code_tools/AST/DynamicSymbol.my.rb +4 -4
- data/lib/myco/code_tools/AST/Invoke.my +3 -4
- data/lib/myco/code_tools/AST/Invoke.my.rb +5 -15
- data/lib/myco/code_tools/AST/InvokeMethod.my.rb +4 -4
- data/lib/myco/code_tools/AST/KeywordAssembly.my.rb +4 -4
- data/lib/myco/code_tools/AST/LocalVariableAccessAmbiguous.my.rb +4 -4
- data/lib/myco/code_tools/AST/LocalVariableAssignment.my.rb +4 -4
- data/lib/myco/code_tools/AST/MycoModuleScope.my +1 -1
- data/lib/myco/code_tools/AST/MycoModuleScope.my.rb +2 -2
- data/lib/myco/code_tools/AST/Node.my.rb +4 -4
- data/lib/myco/code_tools/AST/ParameterAssembly.my.rb +4 -4
- data/lib/myco/code_tools/AST/PipeOperator.my +25 -0
- data/lib/myco/code_tools/AST/PipeOperator.my.rb +28 -0
- data/lib/myco/code_tools/AST/Quest.my.rb +7 -7
- data/lib/myco/code_tools/AST/Script.my.rb +4 -4
- data/lib/myco/code_tools/AST/{Body.my → Sequence.my} +2 -2
- data/lib/myco/code_tools/AST/{Body.my.rb → Sequence.my.rb} +6 -6
- data/lib/myco/code_tools/AST/SplatValue.my.rb +4 -4
- data/lib/myco/code_tools/AST/StringLiteral.my.rb +4 -4
- data/lib/myco/code_tools/AST/SymbolLiteral.my.rb +4 -4
- data/lib/myco/code_tools/AST/ToRuby.my +9 -3
- data/lib/myco/code_tools/AST/ToRuby.my.rb +7 -5
- data/lib/myco/code_tools/AST/misc.my.rb +17 -17
- data/lib/myco/code_tools/AST.my +5 -3
- data/lib/myco/code_tools/AST.my.rb +7 -6
- data/lib/myco/code_tools/Parser.my.rb +4 -4
- data/lib/myco/code_tools/parser/MycoBuilder.my.rb +1 -1
- data/lib/myco/code_tools/parser/MycoCharacterClasses.my.rb +2 -2
- data/lib/myco/code_tools/parser/MycoGrammar.my +68 -25
- data/lib/myco/code_tools/parser/MycoGrammar.my.rb +126 -51
- data/lib/myco/code_tools/parser/MycoTokens.my +3 -2
- data/lib/myco/code_tools/parser/MycoTokens.my.rb +11 -7
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Builder.my.rb +2 -2
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeHelpers.my +1 -1
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeHelpers.my.rb +3 -3
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeInstructions.my +11 -11
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeInstructions.my.rb +11 -11
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeParser.my +1 -1
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/BytecodeParser.my.rb +3 -6
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Constructions.my.rb +40 -40
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Grammar.my +3 -2
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Grammar.my.rb +9 -8
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Instructions.my.rb +2 -2
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Machine.my.rb +2 -2
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Parser.my.rb +2 -2
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Patterns.my.rb +44 -44
- data/lib/myco/code_tools/parser/pegleromyces/lib/pegleromyces/Processor.my.rb +4 -4
- data/lib/myco/tools/BasicCommand.my.rb +4 -4
- data/lib/myco/version.rb +1 -1
- metadata +16 -13
@@ -0,0 +1,25 @@
|
|
1
|
+
|
2
|
+
CodeTools::AST << {
|
3
|
+
|
4
|
+
PipeOperator < Node {
|
5
|
+
var value, var invoke
|
6
|
+
|
7
|
+
Form: [:pipe_op, :value, :invoke]
|
8
|
+
|
9
|
+
implementation_args: ArgumentAssembly.new(
|
10
|
+
line: self.line
|
11
|
+
body: [self.value] + (self.invoke.arguments.?body ?? [])
|
12
|
+
)
|
13
|
+
|
14
|
+
implementation: Invoke.new(
|
15
|
+
line: self.line
|
16
|
+
receiver: self.invoke.receiver
|
17
|
+
name: self.invoke.name
|
18
|
+
arguments: self.implementation_args
|
19
|
+
block: self.invoke.block
|
20
|
+
)
|
21
|
+
|
22
|
+
bytecode: |g| implementation.bytecode(g)
|
23
|
+
}
|
24
|
+
|
25
|
+
}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
|
2
|
+
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition::PipeOperator = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
|
+
declare_meme(:value, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
6
|
+
declare_meme(:invoke, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
7
|
+
::Myco.cscope.for_method_definition::Form = ([
|
8
|
+
:pipe_op,
|
9
|
+
:value,
|
10
|
+
:invoke
|
11
|
+
])
|
12
|
+
declare_meme(:implementation_args, [], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:ArgumentAssembly).new({
|
13
|
+
:line => self.line,
|
14
|
+
:body => [self.value].__send__(
|
15
|
+
:+,
|
16
|
+
::Myco.branch_op(:"??", (self.invoke.arguments.respond_to?(:body).false? ? ::Myco::Void : self.invoke.arguments.body)) {[]}
|
17
|
+
)
|
18
|
+
}))}
|
19
|
+
declare_meme(:implementation, [], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:Invoke).new({
|
20
|
+
:line => self.line,
|
21
|
+
:receiver => self.invoke.receiver,
|
22
|
+
:name => self.invoke.name,
|
23
|
+
:arguments => self.implementation_args,
|
24
|
+
:block => self.invoke.block
|
25
|
+
}))}
|
26
|
+
declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (self.implementation.bytecode(g))}
|
27
|
+
)}}
|
28
|
+
.tap { |__c__| __c__.__name__ = :PipeOperator })})}}.instance
|
@@ -1,14 +1,14 @@
|
|
1
1
|
|
2
2
|
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition::Quest = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
5
|
declare_meme(:receiver, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
6
6
|
declare_meme(:questable, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
7
|
-
::Myco.cscope.for_method_definition
|
7
|
+
::Myco.cscope.for_method_definition::Form = ([
|
8
8
|
:quest,
|
9
9
|
:receiver,
|
10
10
|
:questable
|
11
|
-
])
|
11
|
+
])
|
12
12
|
declare_meme(:questable, [[:setter, []]], nil, ::Myco.cscope.dup) { |given| (
|
13
13
|
given.__send__(
|
14
14
|
:receiver=,
|
@@ -41,11 +41,11 @@
|
|
41
41
|
g.find_const(:Void)
|
42
42
|
end_label.__send__(:set!)
|
43
43
|
)}
|
44
|
-
::Myco.cscope.for_method_definition
|
44
|
+
::Myco.cscope.for_method_definition::FakeReceiver = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
45
45
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
46
|
-
::Myco.cscope.for_method_definition
|
46
|
+
::Myco.cscope.for_method_definition::Form = ([:qrcvr])
|
47
47
|
declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (self.pos(g))}
|
48
|
-
)}}
|
48
|
+
)}}
|
49
49
|
.tap { |__c__| __c__.__name__ = :FakeReceiver }
|
50
|
-
)}}
|
50
|
+
)}}
|
51
51
|
.tap { |__c__| __c__.__name__ = :Quest })})}}.instance
|
@@ -1,15 +1,15 @@
|
|
1
1
|
|
2
2
|
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition::Script = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
5
|
declare_meme(:file, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
6
6
|
declare_meme(:body, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
7
7
|
declare_meme(:variable_scope, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
8
|
-
::Myco.cscope.for_method_definition
|
8
|
+
::Myco.cscope.for_method_definition::Form = ([
|
9
9
|
:script,
|
10
10
|
:file,
|
11
11
|
:body
|
12
|
-
])
|
12
|
+
])
|
13
13
|
declare_meme(:nest_scope, [], nil, ::Myco.cscope.dup) { |scope| (scope.__send__(
|
14
14
|
:parent=,
|
15
15
|
self
|
@@ -29,5 +29,5 @@
|
|
29
29
|
g.ret
|
30
30
|
g.pop_state
|
31
31
|
)}
|
32
|
-
)}}
|
32
|
+
)}}
|
33
33
|
.tap { |__c__| __c__.__name__ = :Script })})}}.instance
|
@@ -1,12 +1,12 @@
|
|
1
1
|
|
2
2
|
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition::Sequence = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
5
|
declare_meme(:array, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
6
|
-
::Myco.cscope.for_method_definition
|
7
|
-
:
|
6
|
+
::Myco.cscope.for_method_definition::Form = ([
|
7
|
+
:sequence,
|
8
8
|
:array
|
9
|
-
])
|
9
|
+
])
|
10
10
|
declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
11
11
|
ary = self.array.dup
|
12
12
|
last = ary.pop
|
@@ -16,5 +16,5 @@
|
|
16
16
|
)}
|
17
17
|
last.bytecode(g)
|
18
18
|
)}
|
19
|
-
)}}
|
20
|
-
.tap { |__c__| __c__.__name__ = :
|
19
|
+
)}}
|
20
|
+
.tap { |__c__| __c__.__name__ = :Sequence })})}}.instance
|
@@ -1,12 +1,12 @@
|
|
1
1
|
|
2
2
|
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition::SplatValue = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
5
|
declare_meme(:value, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
6
|
-
::Myco.cscope.for_method_definition
|
6
|
+
::Myco.cscope.for_method_definition::Form = ([
|
7
7
|
:splat,
|
8
8
|
:value
|
9
|
-
])
|
9
|
+
])
|
10
10
|
declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
11
11
|
self.value.bytecode(g)
|
12
12
|
g.dup
|
@@ -21,5 +21,5 @@
|
|
21
21
|
g.swap
|
22
22
|
g.pop
|
23
23
|
)}
|
24
|
-
)}}
|
24
|
+
)}}
|
25
25
|
.tap { |__c__| __c__.__name__ = :SplatValue })})}}.instance
|
@@ -1,16 +1,16 @@
|
|
1
1
|
|
2
2
|
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition::StringLiteral = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
5
|
declare_meme(:value, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
6
|
-
::Myco.cscope.for_method_definition
|
6
|
+
::Myco.cscope.for_method_definition::Form = ([
|
7
7
|
:str,
|
8
8
|
:value
|
9
|
-
])
|
9
|
+
])
|
10
10
|
declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
11
11
|
self.pos(g)
|
12
12
|
g.push_literal(self.value)
|
13
13
|
g.string_dup
|
14
14
|
)}
|
15
|
-
)}}
|
15
|
+
)}}
|
16
16
|
.tap { |__c__| __c__.__name__ = :StringLiteral })})}}.instance
|
@@ -1,15 +1,15 @@
|
|
1
1
|
|
2
2
|
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(::Myco.cscope.for_method_definition::SymbolLiteral = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
5
|
declare_meme(:value, [[:var, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
6
|
-
::Myco.cscope.for_method_definition
|
6
|
+
::Myco.cscope.for_method_definition::Form = ([
|
7
7
|
:lit,
|
8
8
|
:value
|
9
|
-
])
|
9
|
+
])
|
10
10
|
declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
11
11
|
self.pos(g)
|
12
12
|
g.push_literal(self.value)
|
13
13
|
)}
|
14
|
-
)}}
|
14
|
+
)}}
|
15
15
|
.tap { |__c__| __c__.__name__ = :SymbolLiteral })})}}.instance
|
@@ -294,7 +294,7 @@ CodeTools::AST << {
|
|
294
294
|
}
|
295
295
|
}
|
296
296
|
|
297
|
-
|
297
|
+
Sequence << {
|
298
298
|
to_ruby: |g|
|
299
299
|
g.add("("); g.list(self.array, "", auto_lines:true); g.add(")")
|
300
300
|
}
|
@@ -322,7 +322,7 @@ CodeTools::AST << {
|
|
322
322
|
g.add(")")
|
323
323
|
)
|
324
324
|
|
325
|
-
self.arguments.block.is_a?(
|
325
|
+
self.arguments.block.is_a?(Block) && (
|
326
326
|
g.add(" {"); g.add(self.arguments.block); g.add("}")
|
327
327
|
)
|
328
328
|
}
|
@@ -367,7 +367,7 @@ CodeTools::AST << {
|
|
367
367
|
to_ruby: |g| g.add("&"); g.add(self.body)
|
368
368
|
}
|
369
369
|
|
370
|
-
|
370
|
+
Block << {
|
371
371
|
to_ruby: |g| {
|
372
372
|
g.with_nested_var_scope(self) {
|
373
373
|
g.var_scope_declare_locals(*self.parameters.names)
|
@@ -377,6 +377,8 @@ CodeTools::AST << {
|
|
377
377
|
}
|
378
378
|
}
|
379
379
|
|
380
|
+
BlockLiteral << { to_ruby: |g| g.add(implementation) }
|
381
|
+
|
380
382
|
Quest << {
|
381
383
|
to_ruby: |g| {
|
382
384
|
associated_questable = self.questable.dup
|
@@ -399,4 +401,8 @@ CodeTools::AST << {
|
|
399
401
|
g.add(self.right); g.add('}')
|
400
402
|
}
|
401
403
|
}
|
404
|
+
|
405
|
+
PipeOperator << {
|
406
|
+
to_ruby: |g| g.add(implementation)
|
407
|
+
}
|
402
408
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
3
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.find_constant(:CodeTools)::AST.component_eval {(
|
4
|
-
::Myco.cscope.for_method_definition
|
4
|
+
::Myco.cscope.for_method_definition::ToRuby = ::Myco::Component.new([::Myco::Object], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
5
5
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
6
6
|
declare_meme(:lines, [[:var, []]], nil, ::Myco.cscope.dup) { |*| ([""])}
|
7
7
|
declare_meme(:to_s, [], nil, ::Myco.cscope.dup) { |*| (self.lines.join("\n"))}
|
@@ -79,7 +79,7 @@
|
|
79
79
|
sym
|
80
80
|
).__send__(:!)}
|
81
81
|
)}
|
82
|
-
)}}
|
82
|
+
)}}
|
83
83
|
.tap { |__c__| __c__.__name__ = :ToRuby }
|
84
84
|
::Myco.find_constant(:Node).component_eval {(declare_meme(:to_ruby_code, [], nil, ::Myco.cscope.dup) { |*| (
|
85
85
|
g = ::Myco.find_constant(:ToRuby).new
|
@@ -266,7 +266,7 @@
|
|
266
266
|
) { |proc| (proc.call)}
|
267
267
|
g.add("|")
|
268
268
|
)})}
|
269
|
-
::Myco.find_constant(:
|
269
|
+
::Myco.find_constant(:Sequence).component_eval {(declare_meme(:to_ruby, [], nil, ::Myco.cscope.dup) { |g| (
|
270
270
|
g.add("(")
|
271
271
|
g.list(
|
272
272
|
self.array,
|
@@ -304,7 +304,7 @@
|
|
304
304
|
)}
|
305
305
|
::Myco.branch_op(:"&&", self.arguments.block.__send__(
|
306
306
|
:is_a?,
|
307
|
-
::Myco.find_constant(:
|
307
|
+
::Myco.find_constant(:Block)
|
308
308
|
)) {(
|
309
309
|
g.add(" {")
|
310
310
|
g.add(self.arguments.block)
|
@@ -343,13 +343,14 @@
|
|
343
343
|
g.add("&")
|
344
344
|
g.add(self.body)
|
345
345
|
)})}
|
346
|
-
::Myco.find_constant(:
|
346
|
+
::Myco.find_constant(:Block).component_eval {(declare_meme(:to_ruby, [], nil, ::Myco.cscope.dup) { |g| (g.with_nested_var_scope(self) { || (
|
347
347
|
g.var_scope_declare_locals(*self.parameters.names)
|
348
348
|
g.add(" ")
|
349
349
|
g.add(self.parameters)
|
350
350
|
g.add(" ")
|
351
351
|
g.add(self.body)
|
352
352
|
)})})}
|
353
|
+
::Myco.find_constant(:BlockLiteral).component_eval {(declare_meme(:to_ruby, [], nil, ::Myco.cscope.dup) { |g| (g.add(self.implementation))})}
|
353
354
|
::Myco.find_constant(:Quest).component_eval {(declare_meme(:to_ruby, [], nil, ::Myco.cscope.dup) { |g| (
|
354
355
|
associated_questable = self.questable.dup
|
355
356
|
associated_questable.__send__(
|
@@ -372,4 +373,5 @@
|
|
372
373
|
g.add(self.right)
|
373
374
|
g.add("}")
|
374
375
|
)})}
|
376
|
+
::Myco.find_constant(:PipeOperator).component_eval {(declare_meme(:to_ruby, [], nil, ::Myco.cscope.dup) { |g| (g.add(self.implementation))})}
|
375
377
|
)})}}.instance
|
@@ -12,52 +12,52 @@
|
|
12
12
|
)}
|
13
13
|
declare_meme(:push_null, [], nil, ::Myco.cscope.dup) { |*| (self.push_nil)}
|
14
14
|
)}
|
15
|
-
::Myco.cscope.for_method_definition
|
15
|
+
::Myco.cscope.for_method_definition::Self = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
16
16
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
17
|
-
::Myco.cscope.for_method_definition
|
17
|
+
::Myco.cscope.for_method_definition::Form = ([:self])
|
18
18
|
declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
19
19
|
self.pos(g)
|
20
20
|
g.push_self
|
21
21
|
)}
|
22
|
-
)}}
|
22
|
+
)}}
|
23
23
|
.tap { |__c__| __c__.__name__ = :Self }
|
24
|
-
::Myco.cscope.for_method_definition
|
24
|
+
::Myco.cscope.for_method_definition::NullLiteral = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
25
25
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
26
|
-
::Myco.cscope.for_method_definition
|
26
|
+
::Myco.cscope.for_method_definition::Form = ([:null])
|
27
27
|
declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
28
28
|
self.pos(g)
|
29
29
|
g.push_null
|
30
30
|
)}
|
31
|
-
)}}
|
31
|
+
)}}
|
32
32
|
.tap { |__c__| __c__.__name__ = :NullLiteral }
|
33
|
-
::Myco.cscope.for_method_definition
|
33
|
+
::Myco.cscope.for_method_definition::VoidLiteral = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
34
34
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
35
|
-
::Myco.cscope.for_method_definition
|
35
|
+
::Myco.cscope.for_method_definition::Form = ([:void])
|
36
36
|
declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
37
37
|
self.pos(g)
|
38
38
|
g.push_void
|
39
39
|
)}
|
40
|
-
)}}
|
40
|
+
)}}
|
41
41
|
.tap { |__c__| __c__.__name__ = :VoidLiteral }
|
42
|
-
::Myco.cscope.for_method_definition
|
42
|
+
::Myco.cscope.for_method_definition::TrueLiteral = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
43
43
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
44
|
-
::Myco.cscope.for_method_definition
|
44
|
+
::Myco.cscope.for_method_definition::Form = ([:true])
|
45
45
|
declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
46
46
|
self.pos(g)
|
47
47
|
g.push_true
|
48
48
|
)}
|
49
|
-
)}}
|
49
|
+
)}}
|
50
50
|
.tap { |__c__| __c__.__name__ = :TrueLiteral }
|
51
|
-
::Myco.cscope.for_method_definition
|
51
|
+
::Myco.cscope.for_method_definition::FalseLiteral = ::Myco::Component.new([::Myco.find_constant(:Node)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
52
52
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
53
|
-
::Myco.cscope.for_method_definition
|
53
|
+
::Myco.cscope.for_method_definition::Form = ([:false])
|
54
54
|
declare_meme(:bytecode, [], nil, ::Myco.cscope.dup) { |g| (
|
55
55
|
self.pos(g)
|
56
56
|
g.push_false
|
57
57
|
)}
|
58
|
-
)}}
|
58
|
+
)}}
|
59
59
|
.tap { |__c__| __c__.__name__ = :FalseLiteral }
|
60
|
-
::Myco.cscope.for_method_definition
|
60
|
+
::Myco.cscope.for_method_definition::EVALUATE_NOW = (::CodeTools::AST.component_eval { || (self.constants.select { |const_name| (self.const_get(const_name).constants.__send__(
|
61
61
|
:include?,
|
62
62
|
:Form
|
63
63
|
))}.each { |const_name| (
|
@@ -77,5 +77,5 @@
|
|
77
77
|
))}
|
78
78
|
inst
|
79
79
|
)}
|
80
|
-
)})})
|
80
|
+
)})})
|
81
81
|
)})}}.instance
|
data/lib/myco/code_tools/AST.my
CHANGED
@@ -13,18 +13,20 @@ import 'AST/SymbolLiteral.my'
|
|
13
13
|
import 'AST/DynamicString.my'
|
14
14
|
import 'AST/DynamicSymbol.my'
|
15
15
|
|
16
|
-
import 'AST/
|
16
|
+
import 'AST/Sequence.my'
|
17
17
|
|
18
18
|
import 'AST/SplatValue.my'
|
19
19
|
import 'AST/ArrayAssembly.my'
|
20
20
|
import 'AST/KeywordAssembly.my'
|
21
21
|
import 'AST/ArgumentAssembly.my'
|
22
22
|
import 'AST/BlockArgument.my'
|
23
|
-
import 'AST/
|
23
|
+
import 'AST/Block.my'
|
24
24
|
|
25
25
|
import 'AST/BlockParameter.my'
|
26
26
|
import 'AST/ParameterAssembly.my'
|
27
27
|
|
28
|
+
import 'AST/BlockLiteral.my'
|
29
|
+
|
28
30
|
import 'AST/MycoModuleScope.my'
|
29
31
|
|
30
32
|
import 'AST/ConstantAccess.my'
|
@@ -42,10 +44,10 @@ import 'AST/Invoke.my'
|
|
42
44
|
import 'AST/InvokeMethod.my'
|
43
45
|
import 'AST/LocalVariableAccessAmbiguous.my'
|
44
46
|
import 'AST/LocalVariableAssignment.my'
|
45
|
-
import 'AST/BlockLiteral.my'
|
46
47
|
|
47
48
|
import 'AST/Quest.my'
|
48
49
|
import 'AST/BranchOperator.my'
|
50
|
+
import 'AST/PipeOperator.my'
|
49
51
|
|
50
52
|
# TODO: refactor and break out misc
|
51
53
|
import "AST/misc.my"
|
@@ -2,12 +2,12 @@
|
|
2
2
|
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
3
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
4
4
|
::Myco.find_constant(:CodeTools)::AST.component_eval {(
|
5
|
-
::Myco.cscope.for_method_definition
|
6
|
-
::Myco.cscope.for_method_definition
|
5
|
+
::Myco.cscope.for_method_definition::BuilderMethods = (::Myco.find_constant(:Module).new { || nil})
|
6
|
+
::Myco.cscope.for_method_definition::Builder = ::Myco::Component.new([
|
7
7
|
::Myco.find_constant(:BasicObject),
|
8
8
|
::Myco.find_constant(:BuilderMethods)
|
9
9
|
], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
10
|
-
.tap { |__c__| __c__.__last__ = __c__.component_eval {nil}}
|
10
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {nil}}
|
11
11
|
.tap { |__c__| __c__.__name__ = :Builder }
|
12
12
|
)}
|
13
13
|
declare_meme(:"AST/Node.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
@@ -16,15 +16,16 @@
|
|
16
16
|
declare_meme(:"AST/SymbolLiteral.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
17
17
|
declare_meme(:"AST/DynamicString.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
18
18
|
declare_meme(:"AST/DynamicSymbol.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
19
|
-
declare_meme(:"AST/
|
19
|
+
declare_meme(:"AST/Sequence.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
20
20
|
declare_meme(:"AST/SplatValue.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
21
21
|
declare_meme(:"AST/ArrayAssembly.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
22
22
|
declare_meme(:"AST/KeywordAssembly.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
23
23
|
declare_meme(:"AST/ArgumentAssembly.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
24
24
|
declare_meme(:"AST/BlockArgument.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
25
|
-
declare_meme(:"AST/
|
25
|
+
declare_meme(:"AST/Block.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
26
26
|
declare_meme(:"AST/BlockParameter.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
27
27
|
declare_meme(:"AST/ParameterAssembly.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
28
|
+
declare_meme(:"AST/BlockLiteral.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
28
29
|
declare_meme(:"AST/MycoModuleScope.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
29
30
|
declare_meme(:"AST/ConstantAccess.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
30
31
|
declare_meme(:"AST/ConstantAssignment.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
@@ -40,9 +41,9 @@
|
|
40
41
|
declare_meme(:"AST/InvokeMethod.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
41
42
|
declare_meme(:"AST/LocalVariableAccessAmbiguous.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
42
43
|
declare_meme(:"AST/LocalVariableAssignment.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
43
|
-
declare_meme(:"AST/BlockLiteral.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
44
44
|
declare_meme(:"AST/Quest.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
45
45
|
declare_meme(:"AST/BranchOperator.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
46
|
+
declare_meme(:"AST/PipeOperator.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
46
47
|
declare_meme(:"AST/misc.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
47
48
|
declare_meme(:"AST/ToRuby.my", [[:import, []]], nil, ::Myco.cscope.dup) { |*| nil}
|
48
49
|
)}}.instance
|
@@ -8,13 +8,13 @@
|
|
8
8
|
::Myco::Pegleromyces = (::Myco.find_constant(:Pegleromyces))
|
9
9
|
::Myco.find_constant(:CodeTools)::Parser = ::Myco::Component.new([::Myco.find_constant(:BasicObject)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
10
10
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
11
|
-
::Myco.cscope.for_method_definition
|
12
|
-
::Myco.cscope.for_method_definition
|
13
|
-
::Myco.cscope.for_method_definition
|
11
|
+
::Myco.cscope.for_method_definition::MycoGrammar = (::Myco.find_constant(:Myco).eval_file("parser/MycoGrammar.my"))
|
12
|
+
::Myco.cscope.for_method_definition::MycoBuilder = (::Myco.find_constant(:Myco).eval_file("parser/MycoBuilder.my"))
|
13
|
+
::Myco.cscope.for_method_definition::MycoParser = (::Myco::Component.new([::Myco.find_constant(:Pegleromyces)::BytecodeParser], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
14
14
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
15
15
|
declare_meme(:grammar, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:MycoGrammar))}
|
16
16
|
declare_meme(:new_builder, [], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:MycoBuilder))}
|
17
|
-
)}}.instance)
|
17
|
+
)}}.instance)
|
18
18
|
declare_meme(:parse_string, [], nil, ::Myco.cscope.dup) { |string| (
|
19
19
|
parser = ::Myco.find_constant(:MycoParser)
|
20
20
|
parser.parse(string)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
3
3
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco::Component.new([::Myco.find_constant(:BasicObject)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
|
-
::Myco.cscope.for_method_definition
|
5
|
+
::Myco.cscope.for_method_definition::ASTBuilder = (::CodeTools::AST::Builder.new)
|
6
6
|
declare_meme(:ast, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (::Myco.find_constant(:ASTBuilder))}
|
7
7
|
declare_meme(:escape_encodings, [[:var, []]], nil, ::Myco.cscope.dup) { |*| (
|
8
8
|
hash = ::Myco.find_constant(:Hash).new
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
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
|
3
|
+
.tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco.cscope.for_method_definition::MycoCharacterClasses = (::Myco::Component.new([::Myco.find_constant(:Pegleromyces)::Grammar], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
|
4
4
|
.tap { |__c__| __c__.__last__ = __c__.component_eval {(
|
5
5
|
declare_meme(:eol_comment, [], nil, ::Myco.cscope.dup) { |*| (self.str("#").__send__(
|
6
6
|
:+,
|
@@ -53,4 +53,4 @@
|
|
53
53
|
:/,
|
54
54
|
self.str("?")
|
55
55
|
))}
|
56
|
-
)}}.instance))
|
56
|
+
)}}.instance))}}.instance
|