proinsias 0.6.1 → 1.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a6b3650c4481da95ee2b19c46f4c1f7f72695287f63ff1b2ef06d4c525783541
4
- data.tar.gz: 8940e440c04d1c8a83571bf57d2d8ccbc4cc9cda9b154f8073c8353fce4d7cab
3
+ metadata.gz: 393a5e4558535b3b1fdc47d3a25bca9313e089fd700f4ea4da204dfe9c29a187
4
+ data.tar.gz: 1077ea2ee68a5f7b4f3a67224aa162d2cd1a0da217f109fc7d9bd429750d7f0b
5
5
  SHA512:
6
- metadata.gz: 65c98c12e8b62b84cdd987e56904c2f6d254a49d458932cc8cda423fdd3d1bd16f59bc74fa5710f69f068a66ca87b924c0d789d6fb3f3046b53e605ccd00f4d2
7
- data.tar.gz: b33714bd01a0afe61939ae7e95fb955e6a0595680e88c6e75df00edf91f955ad92e5e4d3f0aa9577a4260a45b1a61e3be25128b77c49331d5c578455fa9eb803
6
+ metadata.gz: 987552175626b6a24a2a2dd7f7cd902d96c703c22aec2e81172a17c29a579791b36533f07bde73e34c63b2878ea3256cdf7c4930464b47cdd3a4a79a5a81ff94
7
+ data.tar.gz: 85bbf2a5fe7d5dea4ada9e7da8558f9ef26a848feba180a2bc8d9a6879fab4b3dbdc60a8140700a4b64733883e7d6aa93ef4eb0190b10a6cbdd4aec87e765ba7
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- proinsias (0.6.1)
4
+ proinsias (1.0.0)
5
5
  moory (~> 1.2.0)
6
6
 
7
7
  GEM
@@ -5,7 +5,7 @@ director = Proinsias::Director.new(
5
5
  )
6
6
 
7
7
  scanner = Proinsias::Scanner.new(
8
- consumer: director.method(:issue)
8
+ consumer: director.method(:issue)
9
9
  )
10
10
 
11
11
  "p ⇒ q ⇒ r ⇒ s".each_char do |c|
data/examples/director.rb CHANGED
@@ -5,7 +5,7 @@ director = Proinsias::Director.new(
5
5
  )
6
6
 
7
7
  scanner = Proinsias::Scanner.new(
8
- consumer: director.method(:issue)
8
+ consumer: director.method(:issue)
9
9
  )
10
10
 
11
11
  "p ≡ p ≡ true".each_char do |c|
@@ -5,7 +5,7 @@ director = Proinsias::Director.new(
5
5
  )
6
6
 
7
7
  scanner = Proinsias::Scanner.new(
8
- consumer: director.method(:issue)
8
+ consumer: director.method(:issue)
9
9
  )
10
10
 
11
11
  "p ⇒ (q ≡ r) ≡ (p ⇒ q) ≡ (p ⇒ r)".each_char do |c|
@@ -1,3 +1,5 @@
1
+ require_relative './assembler'
2
+
1
3
  module Proinsias
2
4
  class AssemblyLine
3
5
  attr_writer :active
@@ -0,0 +1,2 @@
1
+ require_relative './filter'
2
+ require_relative './controller'
@@ -0,0 +1,47 @@
1
+ module Proinsias
2
+ module Configurations
3
+ module Controller
4
+ PIP = # PIP: Prefix Infix Parenthetical
5
+ {
6
+ basis: 'basis',
7
+ specs: {
8
+ 'basis' => {
9
+ rules: """
10
+ ^ : constant : $
11
+ ^ : variable : $
12
+ ^ : prefix / open / defer : Δ
13
+ ^ : lparen / parenthetical / defer : Δ
14
+ $ : infix / open / defer : Δ
15
+
16
+ Δ : term : $
17
+ """,
18
+ },
19
+ 'open' => {
20
+ rules: """
21
+ ^ : constant / term / reconvene : $
22
+ ^ : variable / term / reconvene : $
23
+ ^ : prefix / open / defer : Δ
24
+ ^ : lparen / parenthetical / defer : Δ
25
+ $ : infix / open / defer : Δ
26
+
27
+ Δ : term / term / reconvene : $
28
+ """,
29
+ },
30
+ 'parenthetical' => {
31
+ rules: """
32
+ ^ : constant : C
33
+ ^ : variable : C
34
+ ^ : prefix / open / defer : Δ
35
+ ^ : lparen / parenthetical / defer : Δ
36
+ ^ : rparen / void / reconvene : $
37
+ C : infix / open / defer : Δ
38
+ C : rparen / term / reconvene : $
39
+
40
+ Δ : term : C
41
+ """
42
+ }
43
+ }
44
+ }
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,36 @@
1
+ module Proinsias
2
+ module Configurations
3
+ module Filter
4
+ RULES = """
5
+ ^ : p / p / produce : ^
6
+ ^ : q / q / produce : ^
7
+ ^ : r / r / produce : ^
8
+ ^ : s / s / produce : ^
9
+
10
+ ^ : ¬ / ¬ / produce : ^
11
+
12
+ ^ : ≡ / ≡ / produce : ^
13
+ ^ : ≢ / ≢ / produce : ^
14
+ ^ : ∧ / ∧ / produce : ^
15
+ ^ : ∨ / ∨ / produce : ^
16
+ ^ : ⇒ / ⇒ / produce : ^
17
+ ^ : ⇐ / ⇐ / produce : ^
18
+ ^ : = / = / produce : ^
19
+
20
+ ^ : ( / ( / produce : ^
21
+ ^ : ) / ) / produce : ^
22
+
23
+ ^ : t : 0
24
+ 0 : r : 1
25
+ 1 : u : 2
26
+ 2 : e / true / produce : ^
27
+
28
+ ^ : f : 3
29
+ 3 : a : 4
30
+ 4 : l : 5
31
+ 5 : s : 6
32
+ 6 : e / false / produce : ^
33
+ """
34
+ end
35
+ end
36
+ end
@@ -15,7 +15,7 @@ module Proinsias
15
15
 
16
16
  def controller
17
17
  @controller ||= Moory::Logistic::Controller.new(
18
- Configurations::PIP
18
+ Configurations::Controller::PIP
19
19
  )
20
20
  end
21
21
 
@@ -4,7 +4,7 @@ module Proinsias
4
4
  module Filter
5
5
  def Filter.create(consumer:)
6
6
  Moory::Filter.new(
7
- rules: Proinsias::Configurations::FILTER,
7
+ rules: Proinsias::Configurations::Filter::RULES,
8
8
  consumer: consumer
9
9
  )
10
10
  end
@@ -1,3 +1,7 @@
1
+ require_relative './filter'
2
+ require_relative './scanner'
3
+ require_relative './director'
4
+
1
5
  module Proinsias
2
6
  class Parser
3
7
  def Parser.one_shot(str)
@@ -0,0 +1,29 @@
1
+ module Proinsias
2
+ class Scanner
3
+ attr_accessor :consumer
4
+
5
+ def initialize(consumer:)
6
+ @consumer = consumer
7
+ end
8
+
9
+ def issue(char)
10
+ filter.issue(char)
11
+ end
12
+
13
+ def filter
14
+ @filter ||= Proinsias::Filter.create(
15
+ consumer: method(:forward)
16
+ )
17
+ end
18
+
19
+ def translate(glyph)
20
+ Proinsias::Particle.from_glyph(glyph)
21
+ end
22
+
23
+ def forward(glyph)
24
+ consumer.call(
25
+ translate(glyph)
26
+ )
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,23 @@
1
+ module Proinsias
2
+ module AST
3
+ module Parous
4
+ def to_ast
5
+ {
6
+ @glyph => received.collect { |a| a.to_ast }
7
+ }
8
+ end
9
+ end
10
+
11
+ module Nonparous
12
+ def to_ast
13
+ @glyph
14
+ end
15
+ end
16
+
17
+ module Ephemeral
18
+ def to_ast
19
+ received.first.to_ast
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,143 @@
1
+ module Proinsias
2
+ module Particle
3
+ def Particle.from_glyph(glyph)
4
+ Fundamental.new( glyph_properties(glyph) )
5
+ end
6
+
7
+ def Particle.glyph_properties(glyph)
8
+ DEFINITIONS.detect { |p| p[:glyph] == glyph }
9
+ end
10
+
11
+ DEFINITIONS = [
12
+ # - CONSTANTS
13
+ {
14
+ glyph: 'true',
15
+ role: 'constant',
16
+ capacity: 0,
17
+ strength: 0,
18
+ disposition: 'Pessimistic',
19
+ },
20
+ {
21
+ glyph: 'false',
22
+ role: 'constant',
23
+ capacity: 0,
24
+ strength: 0,
25
+ disposition: 'Pessimistic',
26
+ },
27
+ # - VARIABLES
28
+ {
29
+ glyph: 'p',
30
+ role: 'variable',
31
+ capacity: 0,
32
+ strength: 0,
33
+ disposition: 'Pessimistic',
34
+ },
35
+ {
36
+ glyph: 'q',
37
+ role: 'variable',
38
+ capacity: 0,
39
+ strength: 0,
40
+ disposition: 'Pessimistic',
41
+ },
42
+ {
43
+ glyph: 'r',
44
+ role: 'variable',
45
+ capacity: 0,
46
+ strength: 0,
47
+ disposition: 'Pessimistic',
48
+ },
49
+ {
50
+ glyph: 's',
51
+ role: 'variable',
52
+ capacity: 0,
53
+ strength: 0,
54
+ disposition: 'Pessimistic',
55
+ },
56
+ {
57
+ glyph: 'e',
58
+ role: 'variable',
59
+ capacity: 0,
60
+ strength: 0,
61
+ disposition: 'Pessimistic',
62
+ },
63
+
64
+ # - OPERATORS
65
+ {
66
+ glyph: '¬',
67
+ role: 'prefix',
68
+ capacity: 1,
69
+ strength: 2,
70
+ disposition: 'Pessimistic',
71
+ },
72
+ {
73
+ glyph: '⇒',
74
+ role: 'infix',
75
+ capacity: 2,
76
+ strength: 11,
77
+ disposition: 'Pessimistic',
78
+ },
79
+ {
80
+ glyph: '⇐',
81
+ role: 'infix',
82
+ capacity: 2,
83
+ strength: 11,
84
+ disposition: 'Optimistic',
85
+ },
86
+ {
87
+ glyph: '≡',
88
+ role: 'infix',
89
+ capacity: 2,
90
+ strength: 12,
91
+ disposition: 'Optimistic',
92
+ },
93
+ {
94
+ glyph: '≢',
95
+ role: 'infix',
96
+ capacity: 2,
97
+ strength: 12,
98
+ disposition: 'Optimistic',
99
+ },
100
+ {
101
+ glyph: '∨',
102
+ role: 'infix',
103
+ capacity: 2,
104
+ strength: 10,
105
+ disposition: 'Optimistic',
106
+ },
107
+ {
108
+ glyph: '∧',
109
+ role: 'infix',
110
+ capacity: 2,
111
+ strength: 9,
112
+ disposition: 'Optimistic',
113
+ },
114
+ {
115
+ glyph: '=',
116
+ role: 'infix',
117
+ capacity: 2,
118
+ strength: 9,
119
+ disposition: 'Optimistic',
120
+ },
121
+
122
+ # -- OUTFIX
123
+ {
124
+ glyph: '(',
125
+ role: 'lparen',
126
+ capacity: 1,
127
+ strength: 0,
128
+ disposition: 'Pessimistic',
129
+ ephemeral: true,
130
+ sentinel: 'rparen',
131
+ },
132
+
133
+ # -- SENTINELS
134
+ {
135
+ glyph: ')',
136
+ role: 'rparen',
137
+ capacity: 1,
138
+ strength: 12,
139
+ disposition: 'Optimistic',
140
+ },
141
+ ]
142
+ end
143
+ end
@@ -0,0 +1,30 @@
1
+ module Proinsias
2
+ module Particle
3
+ Fundamental = Class.new do
4
+ include Receiver
5
+
6
+ attr_reader :glyph, :capacity, :strength, :role, :disposition
7
+ attr_reader :sentinel
8
+ attr_reader :ephemeral
9
+
10
+ def initialize(definition)
11
+ @glyph = definition.fetch(:glyph)
12
+ @capacity = definition.fetch(:capacity)
13
+ @strength = definition.fetch(:strength)
14
+ @role = definition.fetch(:role)
15
+ @disposition = definition.fetch(:disposition)
16
+ @sentinel = definition.fetch(:sentinel,nil)
17
+ @ephemeral = definition.fetch(:ephemeral,nil)
18
+
19
+ specialise
20
+ end
21
+
22
+ def specialise
23
+ extend(Disposition.const_get(disposition))
24
+ extend(capacity > 0 ? AST::Parous : AST::Nonparous)
25
+ extend(AST::Ephemeral) if ephemeral
26
+ extend(Outfix) if sentinel
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,35 @@
1
+ require_relative './definitions'
2
+ require_relative './fundamental'
3
+ require_relative './ast'
4
+
5
+ module Proinsias
6
+ module Particle
7
+ module Foundation
8
+ include Receiver
9
+ attr_reader :role
10
+ end
11
+
12
+ module Atom
13
+ include Foundation
14
+ include AST::Nonparous
15
+ include Disposition::Pessimistic
16
+ end
17
+
18
+ module Operator
19
+ include Foundation
20
+ include AST::Parous
21
+ alias arguments received
22
+ end
23
+
24
+ module Outfix
25
+ def receive(particle)
26
+ if particle.role == @sentinel
27
+ @glyph = "#{@glyph} #{@sentinel}"
28
+ @received = particle.received
29
+ else
30
+ fail "Particle is not the expected sentinel. We wanted: #{@sentinel}"
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,25 @@
1
+ module Proinsias
2
+ module Disposition
3
+ module Optimistic
4
+ attr_reader :strength
5
+ include Comparable
6
+
7
+ def <=>(other)
8
+ return 1 if strength > other.strength
9
+ return 1 if strength == other.strength
10
+ return -1 if strength < other.strength
11
+ end
12
+ end
13
+
14
+ module Pessimistic
15
+ attr_reader :strength
16
+ include Comparable
17
+
18
+ def <=>(other)
19
+ return 1 if strength > other.strength
20
+ return -1 if strength == other.strength
21
+ return -1 if strength < other.strength
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,3 +1,5 @@
1
+ require_relative './disposition'
2
+
1
3
  module Proinsias
2
4
  module Receiver
3
5
  attr_accessor :received, :capacity, :flexible
@@ -1,3 +1,3 @@
1
1
  module Proinsias
2
- VERSION = "0.6.1"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/proinsias.rb CHANGED
@@ -1,13 +1,9 @@
1
1
  require "proinsias/version"
2
- require "proinsias/filter"
3
- require "proinsias/configurations"
4
- require "proinsias/receiver"
5
- require "proinsias/particle"
6
- require "proinsias/scanner"
7
- require "proinsias/assembler"
8
- require "proinsias/director"
9
- require "proinsias/assemblyline"
10
- require "proinsias/parser"
2
+ require "proinsias/configurations/configurations"
3
+ require "proinsias/receiver/receiver"
4
+ require "proinsias/particle/particle"
5
+ require "proinsias/assemblyline/assemblyline"
6
+ require "proinsias/parser/parser"
11
7
 
12
8
 
13
9
  module Proinsias
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proinsias
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam W. Grant
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-11 00:00:00.000000000 Z
11
+ date: 2018-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -89,15 +89,21 @@ files:
89
89
  - examples/parser.rb
90
90
  - examples/scanner.rb
91
91
  - lib/proinsias.rb
92
- - lib/proinsias/assembler.rb
93
- - lib/proinsias/assemblyline.rb
94
- - lib/proinsias/configurations.rb
95
- - lib/proinsias/director.rb
96
- - lib/proinsias/filter.rb
97
- - lib/proinsias/parser.rb
98
- - lib/proinsias/particle.rb
99
- - lib/proinsias/receiver.rb
100
- - lib/proinsias/scanner.rb
92
+ - lib/proinsias/assemblyline/assembler.rb
93
+ - lib/proinsias/assemblyline/assemblyline.rb
94
+ - lib/proinsias/configurations/configurations.rb
95
+ - lib/proinsias/configurations/controller.rb
96
+ - lib/proinsias/configurations/filter.rb
97
+ - lib/proinsias/parser/director.rb
98
+ - lib/proinsias/parser/filter.rb
99
+ - lib/proinsias/parser/parser.rb
100
+ - lib/proinsias/parser/scanner.rb
101
+ - lib/proinsias/particle/ast.rb
102
+ - lib/proinsias/particle/definitions.rb
103
+ - lib/proinsias/particle/fundamental.rb
104
+ - lib/proinsias/particle/particle.rb
105
+ - lib/proinsias/receiver/disposition.rb
106
+ - lib/proinsias/receiver/receiver.rb
101
107
  - lib/proinsias/version.rb
102
108
  - proinsias.gemspec
103
109
  homepage: https://github.com/elclavijero/proinsias
@@ -1,76 +0,0 @@
1
- module Proinsias
2
- module Configurations
3
- FILTER = """
4
- ^ : p / p / produce : ^
5
- ^ : q / q / produce : ^
6
- ^ : r / r / produce : ^
7
- ^ : s / s / produce : ^
8
-
9
- ^ : ¬ / ¬ / produce : ^
10
-
11
- ^ : ≡ / ≡ / produce : ^
12
- ^ : ≢ / ≢ / produce : ^
13
- ^ : ∧ / ∧ / produce : ^
14
- ^ : ∨ / ∨ / produce : ^
15
- ^ : ⇒ / ⇒ / produce : ^
16
- ^ : ⇐ / ⇐ / produce : ^
17
- ^ : = / = / produce : ^
18
-
19
- ^ : ( / ( / produce : ^
20
- ^ : ) / ) / produce : ^
21
-
22
- ^ : t : 0
23
- 0 : r : 1
24
- 1 : u : 2
25
- 2 : e / true / produce : ^
26
-
27
- ^ : f : 3
28
- 3 : a : 4
29
- 4 : l : 5
30
- 5 : s : 6
31
- 6 : e / false / produce : ^
32
- """
33
-
34
- PIP = # PIP: Prefix Infix Parenthetical
35
- {
36
- basis: 'basis',
37
- specs: {
38
- 'basis' => {
39
- rules: """
40
- ^ : constant : $
41
- ^ : variable : $
42
- ^ : prefix / open / defer : Δ
43
- ^ : lparen / parenthetical / defer : Δ
44
- $ : infix / open / defer : Δ
45
-
46
- Δ : term : $
47
- """,
48
- },
49
- 'open' => {
50
- rules: """
51
- ^ : constant / term / reconvene : $
52
- ^ : variable / term / reconvene : $
53
- ^ : prefix / open / defer : Δ
54
- ^ : lparen / parenthetical / defer : Δ
55
- $ : infix / open / defer : Δ
56
-
57
- Δ : term / term / reconvene : $
58
- """,
59
- },
60
- 'parenthetical' => {
61
- rules: """
62
- ^ : constant : C
63
- ^ : variable : C
64
- ^ : prefix / open / defer : Δ
65
- ^ : lparen / parenthetical / defer : Δ
66
- ^ : rparen / void / reconvene : $
67
- C : infix / open / defer : Δ
68
- C : rparen / term / reconvene : $
69
-
70
- Δ : term : C
71
- """
72
- }
73
- }
74
- }
75
- end
76
- end
@@ -1,201 +0,0 @@
1
- module Proinsias
2
- module Disposition
3
- module Optimistic
4
- attr_reader :strength
5
- include Comparable
6
-
7
- def <=>(other)
8
- return 1 if strength > other.strength
9
- return 1 if strength == other.strength
10
- return -1 if strength < other.strength
11
- end
12
- end
13
-
14
- module Pessimistic
15
- attr_reader :strength
16
- include Comparable
17
-
18
- def <=>(other)
19
- return 1 if strength > other.strength
20
- return -1 if strength == other.strength
21
- return -1 if strength < other.strength
22
- end
23
- end
24
- end
25
-
26
- module Particle
27
- class Atom
28
- include Receiver
29
- include Disposition::Pessimistic
30
-
31
- attr_reader :role
32
-
33
- def initialize(glyph)
34
- @glyph = glyph
35
- @capacity = 0
36
- @strength = 0
37
- end
38
-
39
- def to_ast
40
- @glyph
41
- end
42
- end
43
-
44
- class Constant < Atom
45
- def initialize(glyph)
46
- super
47
- @role = 'constant'
48
- end
49
- end
50
-
51
- class Variable < Atom
52
- def initialize(glyph)
53
- super
54
- @role = 'variable'
55
- end
56
- end
57
- end
58
-
59
- module Particle
60
- class Operator
61
- include Proinsias::Receiver
62
-
63
- attr_reader :role
64
-
65
- alias arguments received
66
-
67
- def to_ast
68
- {
69
- @glyph => arguments.collect { |a| a.to_ast }
70
- }
71
- end
72
- end
73
-
74
- class BinaryOperator < Operator
75
- def initialize(glyph)
76
- @glyph = glyph
77
- @capacity = 2
78
- end
79
- end
80
-
81
- class UnaryOperator < Operator
82
- def initialize(glyph)
83
- @glyph = glyph
84
- @capacity = 1
85
- end
86
- end
87
-
88
- class LParen < UnaryOperator
89
- include Disposition::Pessimistic
90
-
91
- def initialize(glyph='(')
92
- super
93
- @strength = 0
94
- @role = 'lparen'
95
- end
96
-
97
- def to_ast
98
- arguments.first.to_ast
99
- end
100
-
101
- def receive(rparen)
102
- if rparen.is_a?(Proinsias::Particle::RParen)
103
- @glyph = '()'
104
- @received = rparen.received
105
- else
106
- fail "Argument is not an RParen" unless rparen.is_a?(Proinsias::Particle::RParen)
107
- end
108
- end
109
- end
110
-
111
- class RParen < UnaryOperator
112
- include Disposition::Optimistic
113
-
114
- def initialize(glyph=')')
115
- super
116
- @strength = 12
117
- @role = 'rparen'
118
- end
119
- end
120
-
121
- class Negation < UnaryOperator
122
- include Disposition::Pessimistic
123
-
124
- def initialize(glyph='¬')
125
- super
126
- @strength = 2
127
- @role = 'prefix'
128
- end
129
- end
130
-
131
- class Equivalence < BinaryOperator
132
- include Disposition::Optimistic
133
-
134
- def initialize(glyph='≡')
135
- super
136
- @strength = 12
137
- @role = 'infix'
138
- end
139
- end
140
-
141
- class Inequivalence < BinaryOperator
142
- include Disposition::Optimistic
143
-
144
- def initialize(glyph='≢')
145
- super
146
- @strength = 12
147
- @role = 'infix'
148
- end
149
- end
150
-
151
- class Consequence < BinaryOperator
152
- include Disposition::Optimistic
153
-
154
- def initialize(glyph='⇐')
155
- super
156
- @strength = 11
157
- @role = 'infix'
158
- end
159
- end
160
-
161
- class Implication < BinaryOperator
162
- include Disposition::Pessimistic
163
-
164
- def initialize(glyph='⇒')
165
- super
166
- @strength = 11
167
- @role = 'infix'
168
- end
169
- end
170
-
171
- class Equality < BinaryOperator
172
- include Disposition::Optimistic
173
-
174
- def initialize(glyph='=')
175
- super
176
- @strength = 9
177
- @role = 'infix'
178
- end
179
- end
180
-
181
- class Disjunction < BinaryOperator
182
- include Disposition::Optimistic
183
-
184
- def initialize(glyph='∨')
185
- super
186
- @strength = 10
187
- @role = 'infix'
188
- end
189
- end
190
-
191
- class Conjunction < BinaryOperator
192
- include Disposition::Optimistic
193
-
194
- def initialize(glyph='∧')
195
- super
196
- @strength = 10
197
- @role = 'infix'
198
- end
199
- end
200
- end
201
- end
@@ -1,50 +0,0 @@
1
- module Proinsias
2
- class Scanner
3
- attr_accessor :consumer
4
-
5
- def initialize(consumer:)
6
- @consumer = consumer
7
- end
8
-
9
- def issue(char)
10
- filter.issue(char)
11
- end
12
-
13
- def filter
14
- @filter ||= Proinsias::Filter.create(
15
- consumer: method(:forward)
16
- )
17
- end
18
-
19
- def translate(glyph)
20
- map = {
21
- 'p' => 'Variable',
22
- 'q' => 'Variable',
23
- 'r' => 'Variable',
24
- 's' => 'Variable',
25
- 'true' => 'Constant',
26
- 'false' => 'Constant',
27
- '¬' => 'Negation',
28
- '≡' => 'Equivalence',
29
- '≢' => 'Inequivalence',
30
- '⇐' => 'Consequence',
31
- '⇒' => 'Implication',
32
- '=' => 'Equality',
33
- '∨' => 'Disjunction',
34
- '∧' => 'Conjunction',
35
- '(' => 'LParen',
36
- ')' => 'RParen',
37
- }
38
-
39
- Proinsias::Particle
40
- .const_get(map[glyph])
41
- .send(:new, glyph)
42
- end
43
-
44
- def forward(glyph)
45
- consumer.call(
46
- translate(glyph)
47
- )
48
- end
49
- end
50
- end