summaryrefslogtreecommitdiff
path: root/grammar.rb
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-06-12 14:29:51 +0200
committerPatrick Simianer <p@simianer.de>2014-06-12 14:29:51 +0200
commit7d267062cd109ac27cff8a818ff368b949d7f6a0 (patch)
tree56b043be1e4dd85987b5476644d2f6f7063e8d08 /grammar.rb
parenta981df066484f799637c8a0b88209110038e3148 (diff)
cleanup
Diffstat (limited to 'grammar.rb')
-rw-r--r--grammar.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/grammar.rb b/grammar.rb
index 2506d61..a8ec07c 100644
--- a/grammar.rb
+++ b/grammar.rb
@@ -15,7 +15,7 @@ end
class NT
attr_accessor :symbol, :index
- def initialize symbol=nil, index=nil
+ def initialize symbol=nil, index=-1
@symbol = symbol
@index = index
end
@@ -119,7 +119,7 @@ class Grammar
@rules.map { |r| r.lhs.symbol }.select { |s| s != 'S' }.uniq.each { |symbol|
@rules << Rule.new(NT.new('S'), [NT.new(symbol, 0)], [NT.new(symbol, 0)], [0])
@startn << @rules.last
- @rules << Rule.new(NT.new('S'), [NT.new('S', 0), NT.new('X'), 1], [NT.new('S', 0), NT.new('X'), 1], [0, 1])
+ @rules << Rule.new(NT.new('S'), [NT.new('S', 0), NT.new('X', 1)], [NT.new('S', 0), NT.new('X', 1)], [0, 1])
@startn << @rules.last
}
end