From: Pierre-Charles David Date: 2001-12-12T22:33:38+09:00 Subject: [ruby-talk:28341] Re: Rendering UML diagrams? Dave Thomas writes: > Robert Feldt writes: > > > BTW, I guess you couldn't wait on a RubyInRuby parser any longer? I'll be > > releasing this week. What kind of solution do you use now? > > I adopted the lexer from irb, and the top-level parser from rtags. I > then added a recursive-descent parse for the stuff I neded. The > combination works very well, and is about 1700 lines of Ruby. However, > it will definitely need tidying up over time, as it carries with it > some or its irb heritage. Just an idea: it seems to me that lots of projects need a Ruby parser, but everybody is reimplementing his own (probably incomplete/buggy/inefficient). The Ruby interpreter already does all this work, so would not it be simpler to "open" the parser and to provide an interface to client programs? I'm thinking of something like 'Ruby.parse(aString)' which would return a (simplified) AST (with comments kept to allow RubyDoc and friends). IIRC, Smalltalk has something like this, correct? I have no idea how difficult it would be to implement, but it would greatly simplify the development of all kinds of tools. If the current interpreter structure is too complicated to hack, maybe this feature could be included in Rite? -- Pierre-Charles David (pcdavid emn fr) Computer Science PhD Student, �cole des Mines de Nantes, France Homepage: http://purl.org/net/home/pcdavid