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
@@ -0,0 +1,663 @@
1
+
2
+ ::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
3
+ .tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco::Component.new([::Myco.find_constant(:BasicSpec)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
4
+ .tap { |__c__| __c__.__last__ = __c__.component_eval {(
5
+ declare_meme(:name, [], nil, ::Myco.cscope.dup) { |*| ("Constructions")}
6
+ __category__(:tests).component_eval {(
7
+ declare_meme(:"AnyCharacter creates a single any instruction", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
8
+ construct = ::Myco.find_constant(:Constructions)::AnyCharacter.new
9
+ self.assert_equal(
10
+ construct.sequence,
11
+ [[
12
+ :any,
13
+ 1
14
+ ]]
15
+ )
16
+ )}
17
+ declare_meme(:"Character creates a single char instruction", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
18
+ construct = ::Myco.find_constant(:Constructions)::Character.new({:code => 120})
19
+ self.assert_equal(
20
+ construct.sequence,
21
+ [[
22
+ :char,
23
+ 120
24
+ ]]
25
+ )
26
+ )}
27
+ declare_meme(:"CharacterString creates a string of char instructions", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
28
+ construct = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
29
+ 120,
30
+ 121,
31
+ 122
32
+ ]})
33
+ self.assert_equal(
34
+ construct.sequence,
35
+ [
36
+ [
37
+ :char,
38
+ 120
39
+ ],
40
+ [
41
+ :char,
42
+ 121
43
+ ],
44
+ [
45
+ :char,
46
+ 122
47
+ ]
48
+ ]
49
+ )
50
+ )}
51
+ declare_meme(:"CharacterSet creates a single charset instruction", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
52
+ construct = ::Myco.find_constant(:Constructions)::CharacterSet.new({:codes => [
53
+ 120,
54
+ 121,
55
+ 122
56
+ ]})
57
+ expected_table = [
58
+ 120,
59
+ 121,
60
+ 122
61
+ ].map { |code| ([
62
+ code,
63
+ true
64
+ ])}.to_h
65
+ self.assert_equal(
66
+ construct.sequence,
67
+ [[
68
+ :charset,
69
+ expected_table
70
+ ]]
71
+ )
72
+ )}
73
+ declare_meme(:"CharacterRange creates a single charrange instruction", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
74
+ construct = ::Myco.find_constant(:Constructions)::CharacterRange.new({
75
+ :start => 120,
76
+ :stop => 122
77
+ })
78
+ self.assert_equal(
79
+ construct.sequence,
80
+ [[
81
+ :charrange,
82
+ 120,
83
+ 122
84
+ ]]
85
+ )
86
+ )}
87
+ declare_meme(:"NegativePredicate assembles choice, fail_twice instructions", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
88
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
89
+ 120,
90
+ 121,
91
+ 122
92
+ ]})
93
+ construct = ::Myco.find_constant(:Constructions)::NegativePredicate.new({:inner => a})
94
+ self.assert_equal(
95
+ construct.sequence,
96
+ [
97
+ [
98
+ :choice,
99
+ 5
100
+ ],
101
+ [
102
+ :char,
103
+ 120
104
+ ],
105
+ [
106
+ :char,
107
+ 121
108
+ ],
109
+ [
110
+ :char,
111
+ 122
112
+ ],
113
+ [:fail_twice]
114
+ ]
115
+ )
116
+ )}
117
+ declare_meme(:"PositivePredicate assembles choice, commit, fail instructions", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
118
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
119
+ 120,
120
+ 121,
121
+ 122
122
+ ]})
123
+ construct = ::Myco.find_constant(:Constructions)::PositivePredicate.new({:inner => a})
124
+ self.assert_equal(
125
+ construct.sequence,
126
+ [
127
+ [
128
+ :choice,
129
+ 7
130
+ ],
131
+ [
132
+ :choice,
133
+ 4
134
+ ],
135
+ [
136
+ :char,
137
+ 120
138
+ ],
139
+ [
140
+ :char,
141
+ 121
142
+ ],
143
+ [
144
+ :char,
145
+ 122
146
+ ],
147
+ [
148
+ :commit,
149
+ 1
150
+ ],
151
+ [:fail]
152
+ ]
153
+ )
154
+ )}
155
+ declare_meme(:"OneOrMore assembles UNOPTIMIZED instructions", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
156
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
157
+ 120,
158
+ 121,
159
+ 122
160
+ ]})
161
+ construct = ::Myco.find_constant(:Constructions)::OneOrMore.new({:inner => a})
162
+ self.assert_equal(
163
+ construct.sequence,
164
+ [
165
+ [
166
+ :char,
167
+ 120
168
+ ],
169
+ [
170
+ :char,
171
+ 121
172
+ ],
173
+ [
174
+ :char,
175
+ 122
176
+ ],
177
+ [
178
+ :choice,
179
+ 5
180
+ ],
181
+ [
182
+ :char,
183
+ 120
184
+ ],
185
+ [
186
+ :char,
187
+ 121
188
+ ],
189
+ [
190
+ :char,
191
+ 122
192
+ ],
193
+ [
194
+ :partial_commit,
195
+ -3
196
+ ]
197
+ ]
198
+ )
199
+ )}
200
+ declare_meme(:"ZeroOrOne assembles choice and commit instructions", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
201
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
202
+ 120,
203
+ 121,
204
+ 122
205
+ ]})
206
+ construct = ::Myco.find_constant(:Constructions)::ZeroOrOne.new({:inner => a})
207
+ self.assert_equal(
208
+ construct.sequence,
209
+ [
210
+ [
211
+ :choice,
212
+ 5
213
+ ],
214
+ [
215
+ :char,
216
+ 120
217
+ ],
218
+ [
219
+ :char,
220
+ 121
221
+ ],
222
+ [
223
+ :char,
224
+ 122
225
+ ],
226
+ [
227
+ :commit,
228
+ 1
229
+ ]
230
+ ]
231
+ )
232
+ )}
233
+ declare_meme(:"ZeroOrMore assembles choice and partial_commit instructions", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
234
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
235
+ 120,
236
+ 121,
237
+ 122
238
+ ]})
239
+ construct = ::Myco.find_constant(:Constructions)::ZeroOrMore.new({:inner => a})
240
+ self.assert_equal(
241
+ construct.sequence,
242
+ [
243
+ [
244
+ :choice,
245
+ 5
246
+ ],
247
+ [
248
+ :char,
249
+ 120
250
+ ],
251
+ [
252
+ :char,
253
+ 121
254
+ ],
255
+ [
256
+ :char,
257
+ 122
258
+ ],
259
+ [
260
+ :partial_commit,
261
+ -3
262
+ ]
263
+ ]
264
+ )
265
+ )}
266
+ declare_meme(:"ZeroOrMore<CharacterSet> creates a single span instruction", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
267
+ a = ::Myco.find_constant(:Constructions)::CharacterSet.new({:codes => [
268
+ 120,
269
+ 121,
270
+ 122
271
+ ]})
272
+ construct = ::Myco.find_constant(:Constructions)::ZeroOrMore.new({:inner => a})
273
+ expected_table = [
274
+ 120,
275
+ 121,
276
+ 122
277
+ ].map { |code| ([
278
+ code,
279
+ true
280
+ ])}.to_h
281
+ self.assert_equal(
282
+ construct.sequence,
283
+ [[
284
+ :span,
285
+ expected_table
286
+ ]]
287
+ )
288
+ )}
289
+ declare_meme(:"OrderedChoice assembles choice and commit instructions", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
290
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
291
+ 110,
292
+ 111,
293
+ 112
294
+ ]})
295
+ b = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
296
+ 120,
297
+ 121,
298
+ 122
299
+ ]})
300
+ construct = ::Myco.find_constant(:Constructions)::OrderedChoice.new({
301
+ :first => a,
302
+ :second => b
303
+ })
304
+ self.assert_equal(
305
+ construct.sequence,
306
+ [
307
+ [
308
+ :choice,
309
+ 5
310
+ ],
311
+ [
312
+ :char,
313
+ 110
314
+ ],
315
+ [
316
+ :char,
317
+ 111
318
+ ],
319
+ [
320
+ :char,
321
+ 112
322
+ ],
323
+ [
324
+ :commit,
325
+ 4
326
+ ],
327
+ [
328
+ :char,
329
+ 120
330
+ ],
331
+ [
332
+ :char,
333
+ 121
334
+ ],
335
+ [
336
+ :char,
337
+ 122
338
+ ]
339
+ ]
340
+ )
341
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
342
+ 110,
343
+ 111,
344
+ 112
345
+ ]})
346
+ b = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
347
+ 120,
348
+ 121,
349
+ 122
350
+ ]})
351
+ c = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
352
+ 130,
353
+ 131,
354
+ 132
355
+ ]})
356
+ construct = ::Myco.find_constant(:Constructions)::OrderedChoice.new({
357
+ :first => b,
358
+ :second => c
359
+ })
360
+ construct = ::Myco.find_constant(:Constructions)::OrderedChoice.new({
361
+ :first => a,
362
+ :second => construct
363
+ })
364
+ self.assert_equal(
365
+ construct.sequence,
366
+ [
367
+ [
368
+ :choice,
369
+ 5
370
+ ],
371
+ [
372
+ :char,
373
+ 110
374
+ ],
375
+ [
376
+ :char,
377
+ 111
378
+ ],
379
+ [
380
+ :char,
381
+ 112
382
+ ],
383
+ [
384
+ :commit,
385
+ 9
386
+ ],
387
+ [
388
+ :choice,
389
+ 5
390
+ ],
391
+ [
392
+ :char,
393
+ 120
394
+ ],
395
+ [
396
+ :char,
397
+ 121
398
+ ],
399
+ [
400
+ :char,
401
+ 122
402
+ ],
403
+ [
404
+ :commit,
405
+ 4
406
+ ],
407
+ [
408
+ :char,
409
+ 130
410
+ ],
411
+ [
412
+ :char,
413
+ 131
414
+ ],
415
+ [
416
+ :char,
417
+ 132
418
+ ]
419
+ ]
420
+ )
421
+ )}
422
+ declare_meme(:"Concatenation simply concatenates the operands", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
423
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
424
+ 110,
425
+ 111,
426
+ 112
427
+ ]})
428
+ b = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
429
+ 120,
430
+ 121,
431
+ 122
432
+ ]})
433
+ construct = ::Myco.find_constant(:Constructions)::Concatenation.new({
434
+ :first => a,
435
+ :second => b
436
+ })
437
+ self.assert_equal(
438
+ construct.sequence,
439
+ [
440
+ [
441
+ :char,
442
+ 110
443
+ ],
444
+ [
445
+ :char,
446
+ 111
447
+ ],
448
+ [
449
+ :char,
450
+ 112
451
+ ],
452
+ [
453
+ :char,
454
+ 120
455
+ ],
456
+ [
457
+ :char,
458
+ 121
459
+ ],
460
+ [
461
+ :char,
462
+ 122
463
+ ]
464
+ ]
465
+ )
466
+ )}
467
+ declare_meme(:"NamedCapture assembles capture instructions", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
468
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
469
+ 120,
470
+ 121,
471
+ 122
472
+ ]})
473
+ construct = ::Myco.find_constant(:Constructions)::NamedCapture.new({:inner => a})
474
+ self.assert_equal(
475
+ construct.sequence,
476
+ [
477
+ [
478
+ :capture,
479
+ [:c_start]
480
+ ],
481
+ [
482
+ :char,
483
+ 120
484
+ ],
485
+ [
486
+ :char,
487
+ 121
488
+ ],
489
+ [
490
+ :char,
491
+ 122
492
+ ],
493
+ [
494
+ :capture,
495
+ [
496
+ :c_end,
497
+ construct.captargs
498
+ ]
499
+ ]
500
+ ]
501
+ )
502
+ )}
503
+ declare_meme(:"NamedCapture of ZeroOrMore has a special multiplicit strategy", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
504
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
505
+ 120,
506
+ 121,
507
+ 122
508
+ ]})
509
+ b = ::Myco.find_constant(:Constructions)::ZeroOrMore.new({:inner => a})
510
+ construct = ::Myco.find_constant(:Constructions)::NamedCapture.new({:inner => b})
511
+ self.assert_equal(
512
+ construct.sequence,
513
+ [
514
+ [
515
+ :capture,
516
+ [:m_start]
517
+ ],
518
+ [
519
+ :choice,
520
+ 6
521
+ ],
522
+ [
523
+ :char,
524
+ 120
525
+ ],
526
+ [
527
+ :char,
528
+ 121
529
+ ],
530
+ [
531
+ :char,
532
+ 122
533
+ ],
534
+ [
535
+ :capture,
536
+ [
537
+ :m_split,
538
+ nil
539
+ ]
540
+ ],
541
+ [
542
+ :partial_commit,
543
+ -4
544
+ ],
545
+ [
546
+ :capture,
547
+ [
548
+ :m_end,
549
+ nil
550
+ ]
551
+ ]
552
+ ]
553
+ )
554
+ )}
555
+ declare_meme(:"NamedCapture of OneOrMore has a special multiplicit strategy", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
556
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
557
+ 120,
558
+ 121,
559
+ 122
560
+ ]})
561
+ b = ::Myco.find_constant(:Constructions)::OneOrMore.new({:inner => a})
562
+ construct = ::Myco.find_constant(:Constructions)::NamedCapture.new({:inner => b})
563
+ self.assert_equal(
564
+ construct.sequence,
565
+ [
566
+ [
567
+ :capture,
568
+ [:m_start]
569
+ ],
570
+ [
571
+ :char,
572
+ 120
573
+ ],
574
+ [
575
+ :char,
576
+ 121
577
+ ],
578
+ [
579
+ :char,
580
+ 122
581
+ ],
582
+ [
583
+ :capture,
584
+ [
585
+ :m_split,
586
+ nil
587
+ ]
588
+ ],
589
+ [
590
+ :choice,
591
+ 6
592
+ ],
593
+ [
594
+ :char,
595
+ 120
596
+ ],
597
+ [
598
+ :char,
599
+ 121
600
+ ],
601
+ [
602
+ :char,
603
+ 122
604
+ ],
605
+ [
606
+ :capture,
607
+ [
608
+ :m_split,
609
+ nil
610
+ ]
611
+ ],
612
+ [
613
+ :partial_commit,
614
+ -4
615
+ ],
616
+ [
617
+ :capture,
618
+ [
619
+ :m_end,
620
+ nil
621
+ ]
622
+ ]
623
+ ]
624
+ )
625
+ )}
626
+ declare_meme(:"Reduction assembles capture instructions", [[:specify, []]], nil, ::Myco.cscope.dup) { |*| (
627
+ a = ::Myco.find_constant(:Constructions)::CharacterString.new({:codes => [
628
+ 120,
629
+ 121,
630
+ 122
631
+ ]})
632
+ construct = ::Myco.find_constant(:Constructions)::Reduction.new({:inner => a})
633
+ self.assert_equal(
634
+ construct.sequence,
635
+ [
636
+ [
637
+ :capture,
638
+ [:r_start]
639
+ ],
640
+ [
641
+ :char,
642
+ 120
643
+ ],
644
+ [
645
+ :char,
646
+ 121
647
+ ],
648
+ [
649
+ :char,
650
+ 122
651
+ ],
652
+ [
653
+ :capture,
654
+ [
655
+ :r_end,
656
+ construct.captargs
657
+ ]
658
+ ]
659
+ ]
660
+ )
661
+ )}
662
+ )}
663
+ )}}.instance)}}.instance
@@ -0,0 +1,10 @@
1
+
2
+ BasicSpec {
3
+ name: "Grammar"
4
+
5
+ new_grammar: Grammar { }
6
+
7
+ [tests]
8
+
9
+ it "starts with a root rule defined": assert(new_grammar.rules.root)
10
+ }
@@ -0,0 +1,9 @@
1
+
2
+ ::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
3
+ .tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco::Component.new([::Myco.find_constant(:BasicSpec)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
4
+ .tap { |__c__| __c__.__last__ = __c__.component_eval {(
5
+ declare_meme(:name, [], nil, ::Myco.cscope.dup) { |*| ("Grammar")}
6
+ declare_meme(:new_grammar, [], nil, ::Myco.cscope.dup) { |*| (::Myco::Component.new([::Myco.find_constant(:Grammar)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
7
+ .tap { |__c__| __c__.__last__ = __c__.component_eval {nil}}.instance)}
8
+ __category__(:tests).component_eval {(declare_meme(:"starts with a root rule defined", [[:it, []]], nil, ::Myco.cscope.dup) { |*| (self.assert(self.new_grammar.rules.root))})}
9
+ )}}.instance)}}.instance
@@ -0,0 +1,10 @@
1
+
2
+ BasicSpec {
3
+ name: "Instructions"
4
+
5
+ instructions: Instructions { }
6
+
7
+ [tests]
8
+
9
+ it "exists": assert(instructions)
10
+ }
@@ -0,0 +1,9 @@
1
+
2
+ ::Myco::Component.new([::Myco::FileToplevel], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
3
+ .tap { |__c__| __c__.__last__ = __c__.component_eval {(::Myco::Component.new([::Myco.find_constant(:BasicSpec)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
4
+ .tap { |__c__| __c__.__last__ = __c__.component_eval {(
5
+ declare_meme(:name, [], nil, ::Myco.cscope.dup) { |*| ("Instructions")}
6
+ declare_meme(:instructions, [], nil, ::Myco.cscope.dup) { |*| (::Myco::Component.new([::Myco.find_constant(:Instructions)], ::Myco.cscope.for_method_definition, __FILE__, __LINE__)
7
+ .tap { |__c__| __c__.__last__ = __c__.component_eval {nil}}.instance)}
8
+ __category__(:tests).component_eval {(declare_meme(:exists, [[:it, []]], nil, ::Myco.cscope.dup) { |*| (self.assert(self.instructions))})}
9
+ )}}.instance)}}.instance
@@ -0,0 +1,13 @@
1
+
2
+ BasicSpec {
3
+ name: "Machine"
4
+
5
+ new_machine: Machine { }
6
+
7
+ [tests]
8
+
9
+ it "starts pointing to instruction 0": assert_equal(new_machine.ip, 0)
10
+ it "starts pointing to string index 0": assert_equal(new_machine.idx, 0)
11
+ it "starts with an empty stack": assert(new_machine.stack.empty?)
12
+ it "starts with no captures": assert(new_machine.captures.empty?)
13
+ }