From: MikkelFJ Date: 2002-09-18T06:48:28+09:00 Subject: Re: Why are parser tools rarely used in ruby? "why the lucky stiff" wrote in message news:20020917193309.GA29004@rysa.inetz.com... > MikkelFJ (mikkelfj-anti-spam@bigfoot.com) wrote: > > Actually Racc does not seem to be in the 1.6.7 Windows distribution - but I > > recall it being in an earlier version - a cygwin issue? > I've been actively coding a YAML parser for Ruby [http://yaml4r.sf.net/] > which uses Racc for parser. Having always adored Yacc, I found Racc a natural > counterpart. I find it to execute speedily and development itself has been swift. I wouldn't say I adore yacc, I find the $1 etc. syntax cumbersome when you develop the grammar and you write many rules to do simple things - in that respect RockIt rocks. But yacc is efficient and to the point. It has been ported to many many languages. So if you know yacc, racc is the natural for Ruby. > I imagine the lack of Racc usage is primarily due to lack of documentation. I don't see the lack of documentation as a big problem given that I found the racc in the ruby lib directory knowing zero, looked at a readme or an example and were able to write a small parser with no difficulties (granted I've written a few parsers before). My point is that yacc is a langua franca for parser tools. So perhaps you don't learn about yacc syntax reading racc documentation, but it is part of the toolbox any serious language provides. I have also worked with ocamlyacc over the past few months, and it is extremely efficient because it is so easy to build datastructures and because the parser is typesafe (removing many tricky parser bugs early). Racc isn't typesafe, but it does allow you to easily build datastructures, thanks to Ruby. This makes it very much easier than writing an equivalent parser in C. > (Well, and the fact that it doesn't compile on the Playskool desktop platforms.) > Sure, if you know how to use Yacc, the current docs make good sense. Exactly. > I think all > it would take to make Racc more successful is a couple of friendly HOWTOs. I've > been thinking of writing one up on the RubyGarden Wiki. If you don't know yacc, the bison manual is quite good - so perhaps the HOWTO should point that out. Among parser tools it is also worth mentioning ANTLR, although it's only C++ and Java. Mikkel