[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

rlex and ryacc

Luke A. Kanies

11/7/2003 6:05:00 AM

9 Answers

Jim Freeze

11/7/2003 1:17:00 PM

0

On Friday, 7 November 2003 at 15:04:33 +0900, Luke A. Kanies wrote:
> Hi all,
>
> So, my question is: Is there a good parsing solution in ruby right now?
> I really don't want to write my own, as I don't think I'm up to it (I'm
> barely up to writing the parser with a parser compiler), but I really
> would like to use ruby, as all of my prototype code is in ruby and it has
> worked smashingly.
>
> I've read through the ruby-talk archives, and what consensus I could find
> there seemed to point to racc, so maybe I just need someone to correct my
> ideas about how racc works and whether I should use it. I'm not
> particularly attached to yacc-like functionality, as I've really only used
> it once, but I am definitely concerned about speed.
>

I have used racc successfully on a project and did not have a problem
with speed. Howver, there are ways to speed up racc when needed.
Also, you could write your parser in C (IIRC, YAML started out in racc and
went to C. Ask Why.) I am no expert, but I can probably get you going
if you choose racc.

There is also rbison, but I am not familar with the differences between
it and racc, although I think it offers roughly the same features as
racc.

And, rockit is being re-written in C and should be released now, but I
haven't followed its progress.


--
Jim Freeze
----------

Jim Freeze

11/7/2003 1:19:00 PM

0

On Friday, 7 November 2003 at 15:04:33 +0900, Luke A. Kanies wrote:
> Hi all,
>
> with the latest stuff. racc seems to be exist and be current, but it
> looks like a recursive descent parser (I'm not really even sure how to
> tell, it just seems to have a similar grammar), and the last one I used

Oops, missed that question. Racc is LALR(1).


--
Jim Freeze
----------
Good day to let down old friends who need help.

Luke A. Kanies

11/8/2003 6:42:00 PM

0

Luke A. Kanies

11/8/2003 9:05:00 PM

0

Minero Aoki

11/9/2003 9:03:00 AM

0

Minero Aoki

11/9/2003 9:05:00 AM

0

ptkwt

11/10/2003 2:11:00 AM

0

In article <20031109180247X.aamine@loveruby.net>,
Minero Aoki <aamine@loveruby.net> wrote:
>Hi,
>
> In mail "Re: rlex and ryacc"
> "Luke A. Kanies" <luke@madstop.com> wrote:
>
>> I'm still having problems, but I have at least made progress.
>
>> racc:
>> Does not give much info about what to do for a lexer. I've tried
>> rlex, but they have incompatible means of specifying tokens,
>> apparently, so I don't know how to use them together. Without
>> a lexer, I can't really tell if this will work for me.
>
>I'm using StringScanner (strscan). It is NOT a lexer generator,
>but it is sufficient for me (including speed).
>
>For real example of Racc, refer TMail or RDtool.
>
> TMail (uses #yylex. The lexer is written in Ruby and C)
> http://raa.ruby-lang.org/list.rhtml?...
>
> RDtool (uses #do_parse and #next_token.
> The lexer is written in Ruby using strscan)
> http://raa.ruby-lang.org/list.rhtml?n...
>


Why not bundle a lexer with racc?

Phil

Tim Gesekus

11/11/2003 9:49:00 AM

0

* Luke A. Kanies <luke@madstop.com> [2003-11-09 06:04:58 +0900]:
> rlex:
> Does not generate code that's valid for 1.8, but the code does run.
> Does not seem to like parsing strings, only files (I get an infinite
> (loop)
Had the same problems, but made a patch for rlex. It works for me,
but isn't tested to well. And don't forget to redefine wrap to control
wrapping behavior.

Patch for rlex attached.

HTH Tim

--
"Lately, the only thing keeping me from becoming a serial killer is my distaste
for manual labor."
-- Dilbert
NP: Saints of Eden - Slow Stay (Crushed Remix)

Minero Aoki

11/19/2003 5:50:00 AM

0