On Thu, 7 Dec 2000, Yukihiro Matsumoto wrote: > |What is Ruby inside? A Compile to byte-code and then a byte code > |interpreter? Is there a how the Ruby Interpreter works doc in english? > > Ruby compiles script into node tree, then interpreter traverse and > execute it. It will be a byte-code interpreter in the next version. No don't! Make the nodes "primitive" Ruby objects. Then you can have several routes.... Text -> Ruby Object nodes -> C interpreter This is precisely the current state with the only (hopefully small) change being that the nodes are made into Ruby objects. But, for little extra work, you/ruby community get to write, in Ruby, the following... Using the Visitor Pattern [GoF 1995] Text -> Ruby Object nodes -> Ruby Visitor -> Ruby Byte Code generator -> C Interpreter for Byte codes. Text -> Ruby Object nodes -> Ruby Visitor -> Ruby machine code generator. (ie. A Ruby compiler!) Text -> Ruby Object Nodes -> Ruby Visitor -> Ruby Pretty Printer Text -> Ruby Object Nodes -> Ruby Visitor -> * Ruby Profiler. * Coverage tools. * Debuggers. * Refactoring Transforms. * Language sensitive IDE's. * Analyses and metrics of how programmers program. You already have the Text to Nodes converter. It would need to be tweaked (slightly) to make the nodes Ruby accessible primitive objects. You would only need to write the Node Visitor once. Plus you then get full reflection capabilities perfectly equivalent to Lisp/Scheme etc. Reflection goes way beyond Java / Python reflection classes that merely allow one to see who inherits from who, it enables one to treat the code as data. For example, Flex / Bison generate C in a very cumbersome text based way. If Ruby nodes were Ruby Objects, a Ruby Bison would generate Ruby nodes not text. Of course if you wanted a textual representation its merely a matter of hitting it with the Pretty Printer visitor. > And documentation, currently there's only one documentation, which is > written in C. Oh, one more in my brain. Please keep away from Trucks. John Carter Work Email : john / netsys.co.za Private email : cyent / mweb.co.za Yell Phone : 083-543-6915 Phone : 27-12-348-4246 Carter's Compass... I know I'm on the right track when by deleting code I'm adding functionality. [GoF 1995] Design Patterns pg. 331 Gamma, Helm, Johnson & Vlissides.