views:

448

answers:

2

 I want to know whether it is possible to parse ruby language using just deterministic parser having no backtracking at all ??

A: 

Instead of actually having to write a parser, you can always leverage the existing interpreter to do what you want.

For example: ruby2ruby

http://seattlerb.rubyforge.org/ruby2ruby/ ruby2ruby

tadman
A: 

I don't know any specific details about parsing Ruby, or why you insist on "no backtracking". My guess is that you believe the Ruby grammar isn't LALR(1), e.g., isn't processable by YACC or equivalents.

Regardless, if the problem is to parse a language whose grammar is context-free, one can do this using a GLR parser, which does not backtrack:

http://en.wikipedia.org/wiki/GLR_parser

I've used this to build production parsers for many real languages.

Ira Baxter