lucio 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/Gemfile +4 -9
  2. data/Gemfile.lock +3 -11
  3. data/README.md +9 -9
  4. data/Rakefile +0 -3
  5. data/VERSION +1 -1
  6. data/bin/lucio +1 -1
  7. data/bin/repl.rb +19 -21
  8. data/lib/lucio.rb +2 -0
  9. data/lib/lucio/lexicon.rb +12 -20
  10. data/lib/lucio/lucio.rb +48 -18
  11. data/lucio.gemspec +17 -42
  12. data/spec/add_spec.rb +34 -0
  13. data/spec/behead_spec.rb +12 -0
  14. data/spec/divide_spec.rb +26 -0
  15. data/spec/empty_list_spec.rb +23 -0
  16. data/spec/internal_spec.rb +13 -0
  17. data/spec/let_spec.rb +29 -0
  18. data/spec/minus_spec.rb +27 -0
  19. data/spec/readme_examples_spec.rb +32 -0
  20. data/spec/spec_helper.rb +3 -1
  21. data/spec/times_spec.rb +34 -0
  22. metadata +31 -80
  23. data/.autotest +0 -3
  24. data/TODO.md +0 -32
  25. data/lib/lucio/grammar.rb +0 -37
  26. data/lib/lucio/list.rb +0 -22
  27. data/lib/lucio/operators.rb +0 -9
  28. data/lib/lucio/operators/attribution.rb +0 -10
  29. data/lib/lucio/operators/conditional.rb +0 -20
  30. data/lib/lucio/operators/division.rb +0 -16
  31. data/lib/lucio/operators/equality.rb +0 -11
  32. data/lib/lucio/operators/macro.rb +0 -15
  33. data/lib/lucio/operators/multiplication.rb +0 -16
  34. data/lib/lucio/operators/operator.rb +0 -29
  35. data/lib/lucio/operators/subtraction.rb +0 -18
  36. data/lib/lucio/operators/sum.rb +0 -13
  37. data/lib/lucio/runner.rb +0 -60
  38. data/lib/lucio_syntax.treetop +0 -92
  39. data/spec/all_the_fun_spec.rb +0 -21
  40. data/spec/division_spec.rb +0 -19
  41. data/spec/eval_spec.rb +0 -116
  42. data/spec/lucio_spec.rb +0 -25
  43. data/spec/multiplication_spec.rb +0 -19
  44. data/spec/parser_spec.rb +0 -105
  45. data/spec/subtraction_spec.rb +0 -19
  46. data/spec/sum_spec.rb +0 -19
  47. data/spec/variable_spec.rb +0 -13
data/spec/lucio_spec.rb DELETED
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
- require 'lucio'
3
-
4
- describe Lucio do
5
- it "should return head and tail" do
6
- h, t = Lucio.behead [1, 2, 3, 4, 5]
7
- h.should == 1
8
- t.should == [2, 3, 4, 5]
9
- end
10
-
11
- it "should return empty tail" do
12
- h, t = Lucio.behead [1]
13
- h.should == 1
14
- t.should == []
15
- end
16
-
17
- it "should handle empty collections" do
18
- h, t = Lucio.behead []
19
- h.should == nil
20
- t.should == []
21
- end
22
-
23
-
24
- end
25
-
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
- require 'lucio'
3
-
4
- describe Lucio::Operator::Multiplication do
5
- it "an empty list should return zero" do
6
- Lucio.eval('(*)').should == 0
7
- end
8
-
9
- it "a list with one item should return that item" do
10
- Lucio.eval('(* 1)').should == 1
11
- Lucio.eval('(* 2)').should == 2
12
- end
13
-
14
- it "a list with more than one item should eval all items" do
15
- Lucio.eval('(* 2 3)').should == 6
16
- Lucio.eval('(* 2 3 4)').should == 24
17
- end
18
-
19
- end
data/spec/parser_spec.rb DELETED
@@ -1,105 +0,0 @@
1
- require 'spec_helper'
2
- require 'lucio'
3
-
4
- describe Lucio do
5
-
6
- context "list" do
7
- it "integer" do
8
- Lucio.parse('(2)').should be
9
- end
10
-
11
- it "integers" do
12
- Lucio.parse('(2)(3)').should be
13
- end
14
-
15
- it "decimal" do
16
- Lucio.parse('(3.14)').should be
17
- end
18
-
19
- it "valid string" do
20
- Lucio.parse('("this is a text")').should be
21
- end
22
-
23
- it "valid expression" do
24
- Lucio.parse('(this is an expression)').should be
25
- end
26
-
27
- it "boolean" do
28
- Lucio.parse('(true)').should be
29
- Lucio.parse('(true)').should be
30
- Lucio.parse('(true)(false)').should be
31
-
32
- Lucio.parse('true').should_not be
33
- Lucio.parse('false').should_not be
34
- end
35
-
36
- it 'space' do
37
- Lucio.parse('()').should be
38
- Lucio.parse('( )').should be
39
- Lucio.parse('( )').should be
40
- end
41
-
42
- it 'simple expression' do
43
- Lucio.parse('(+ 1 2)').should be
44
- end
45
-
46
- it 'long expression' do
47
- Lucio.parse('(+ 1 2 3 4)').should be
48
- end
49
-
50
- it 'long expression with commas' do
51
- Lucio.parse('(+ 1, 2, 3, 4)').should be
52
- end
53
-
54
- it 'vector' do
55
- Lucio.parse('([1 2 3 4 5 6])').should be
56
- end
57
-
58
- it 'vector with commas' do
59
- Lucio.parse('([1, 2, 3, 4, 5, 6])').should be
60
- end
61
-
62
- it 'composed expression' do
63
- Lucio.parse('(+ 1 (* 2 3))').should be
64
- end
65
-
66
- it 'composed long expression' do
67
- Lucio.parse('(+ 1 2 3 (* 4 5 6))').should be
68
- end
69
-
70
- it 'and now we return to begin' do
71
- Lucio.parse('(* (+ 1 2) 3)').should be
72
-
73
- Lucio.parse('(/ (* (+ 1 2)(+ 3 4)) 2)').should be
74
- end
75
-
76
- it 'special caracters should work to improve the expressiveness' do
77
- Lucio.parse('(eql? (* (+ 1 2) 3) 9)').should be
78
-
79
- Lucio.parse('(eql?? (* (+ 1 2) 3) 9)').should_not be
80
-
81
- Lucio.parse('(foo-bar (1 1 2 3 4 4))').should be
82
- Lucio.parse('(foo-bar-meh (1 1 2 3 4 4))').should be
83
-
84
- Lucio.parse('(foo--bar (1 1 2 3 4 4))').should be_nil
85
- Lucio.parse('(foo--bar (1 1 2 3 4 4))').should_not be
86
- Lucio.parse('(foo----- (1 1 2 3 4 4))').should_not be
87
- Lucio.parse('(foo--bar-meh (1 1 2 3 4 4))').should_not be
88
- end
89
-
90
- it 'multiline' do
91
- code = <<lisp
92
- (/
93
- (*
94
- (+ 1 2)
95
- (+ 3 4))
96
- 2)
97
- lisp
98
-
99
- Lucio.parse(code).should be
100
- end
101
-
102
- end
103
-
104
- end
105
-
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
- require 'lucio'
3
-
4
- describe Lucio::Operator::Subtraction do
5
- it "an empty list should return zero" do
6
- Lucio.eval('(-)').should == 0
7
- end
8
-
9
- it "a list with one item should return that item" do
10
- Lucio.eval('(- 1)').should == -1
11
- Lucio.eval('(- 2)').should == -2
12
- end
13
-
14
- it "a list with more than one item should eval all items" do
15
- Lucio.eval('(- 2 1)').should == 1
16
- Lucio.eval('(- 3 2 1)').should == 0
17
- end
18
-
19
- end
data/spec/sum_spec.rb DELETED
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
- require 'lucio'
3
-
4
- describe Lucio::Operator::Sum do
5
- it "an empty list should return zero" do
6
- Lucio.eval('(+)').should == 0
7
- end
8
-
9
- it "a list with one item should return that item" do
10
- Lucio.eval('(+ 1)').should == 1
11
- Lucio.eval('(+ 2)').should == 2
12
- end
13
-
14
- it "a list with more than one item should eval all items" do
15
- Lucio.eval('(+ 1 2)').should == 3
16
- Lucio.eval('(+ 1 2 3)').should == 6
17
- end
18
-
19
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
- require 'lucio'
3
-
4
- describe 'Var' do
5
- it 'should store some value' do
6
- code = <<lisp
7
- ((let x 3)
8
- (x))
9
- lisp
10
-
11
- p Lucio.eval(code)
12
- end
13
- end