On Tue, May 25, 2010 at 1:29 PM, Brian Hurt <[email protected]> wrote:
> I think the lesson here is "make your language unparseable, and no one will
> be able to parse it".  My advice to people designing new languages is to
> define their grammar in terms of an LALR(1) parser like yacc, javacc, cup,
> etc.  And to not let shift-reduce or reduce-reduce conflicts in.  One of the
> big reasons for this is that any language that is parseable sanely in
> LALR(1) is parseable sanely in just about anything else, the converse is not
> necessarily true.  Fancier parsers such as LL(k) parsers (for example,
> Bison) or top-down parsers (parsec, etc.) are great for parsing lanuages
> that are hard to parse- the idea is to not make your language such.

This is certainly true for Ruby. There are a few attempts at LALR
parsers for Ruby, but none of them have been carried through to
production impls. *All* the current mainstream Ruby implementations
use the original LL(k) Bison grammar or a port of it to
platform-specific variants, largely because the language has a lot of
difficult-to-parse contextual syntax. Of course, a lot of that syntax
is exactly what people love about Ruby...so it's sometimes a tough
call.

- Charlie

-- 
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en.

Reply via email to