# Bug in Racc?

**URL:** <https://www.ruby-forum.com/t/bug-in-racc/74700>\
**Category:** Ruby\
**Created:** [February 28, 2006, 2:30pm UTC](https://www.ruby-forum.com/t/bug-in-racc/74700 "2006-02-28T14:30:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonT](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/5daacb/32.png) [@jonT](https://www.ruby-forum.com/u/jonT)\
**Post date:** [February 28, 2006, 2:30pm UTC](https://www.ruby-forum.com/t/bug-in-racc/74700/1 "2006-02-28T14:30:05Z")

</div>

Hi all,

The following was reported to Minero A. (Racc developer) a while ago;  
he hasn’t replied so I assume he’s busy. Thus I’m putting it out to the  
Ruby community, any ideas would be appreciated. Appologies for the  
lengthy code segment, I wasn’t able to find what exactly was wrong -  
the interaction appears very subtle!

* * *

I’m emailing you to report a potential bug in Racc. Again, I’m aware  
that it is alpha s/w but I do like to help developers create stable  
software :).

Do the following:  
: j@moose:528:0$; wget  
[http://www.tippell.com/files/public/autocomplete\_parser.y](http://www.tippell.com/files/public/autocomplete_parser.y)  
: j@moose:529:0$; racc -o autocomplete\_parser.rb autocomplete\_parser.y  
&& ruby1.9 autocomplete\_parser.rb

You should get output along the lines:  
10 shift/reduce conflicts  
166 reduce/reduce conflicts  
2 useless rules  
005

Now uncomment line 16 and comment out lines 17-20. Repeat and you’ll  
get the output:  
10 shift/reduce conflicts  
170 reduce/reduce conflicts  
2 useless rules  
/usr/local/lib/site\_ruby/1.9/racc/parser.rb:350:in `on_error': (Racc::ParseError) parse error on value "t4" (IDENT) from /usr/local/lib/site_ruby/1.9/racc/parser.rb:99:in `do\_parse’  
from autocomplete\_parser.y:121:in `parse' from autocomplete_parser.rb:1246:in `run’  
from autocomplete\_parser.rb:1248

A similar result can be seen on lines 35-39.

Next return to the original file and uncomment lines 67-79 and comment  
lines 82-108. Run and you’ll get the same error message as before.

Note though that (again from the original), commenting out lines  
133-134 provides the correct result:  
10 shift/reduce conflicts  
166 reduce/reduce conflicts  
2 useless rules  
012

I’m no yacc expert but the guys in the lab have confirmed that my code  
looks correct - and racc compiles it fine. Moreover a parse error at  
runtime rather than at compile time would lead me to believe that my  
code is correct.

Unfortunately I’m also fairly new to Ruby and I don’t read Japanese -  
which puts me at quite a poor position to write fixes.

Can you confirm that this is a bug in Racc?

Cheers,

Jon
