From: Mark Probert Date: 2002-09-30T23:07:22+09:00 Subject: Re: Is Ruby's grammar LL(k)? At 06:29 AM 9/29/2002 +0900, MikkelFJ wrote: > > parseLine unless /^$/ # Don't parse empty lines end >This is a real problem in Ruby parsing I guess: > >You can easily handle many of Rubys linebreak rules if you include linebreak >as a token, but if you do that, you will have to deal with them a lot of >places where you would rather ignore them as whitespace. I think this can be >handled by having the parser cooperating with the lexer. Obviously it is >doable since Ruby parsers exist. It is true that Ruby parsers exist, the question was more related to LL(1) parsers for Ruby. In this case, the challenge isn't the linebreak (I just yanked that code from the Pickaxe book), rather it is the if and unless conditions. As Mauricio points out in another post, these statements can exist in a variety of forms: if then end if end if with or without multiple elsif and else clauses. The optional then is going to cause some LL(1) problems because I don't know that 1 token lookahead is going to be enough. The same is true of the unless, while and until loops, I think. It is going to be fun to try, though ;-) -mark.