From: John Carter Date: 2009-02-11T09:45:43+09:00 Subject: Ruby0 was Re: ruby interpreter written in ruby.. On Mon, 9 Feb 2009, Ryan Davis wrote: > As someone who worked on smalltalk for many years and was working on > metaruby before I was professionally working on rubinius, I have to > highly disagree. I strongly agree with you, what you have been doing _is_ very interesting and valuable. Which leads to some questions I have for you... you probably don't have the answers to them, but your thoughts about what the answers may be should be interesting. 1) The "lisp in lisp" / "joy in joy" / ... interpreters I have seen have sort of glossed over the lexical / parsing issue by assuming that they are interpreting an already internalised representation of the program. This is part of the classic basic data representation === the basic program representation ambiguity of these languages. We can pretty much do this in Ruby too... A ruby program can be represented as an Array of Symbols, Numbers and Strings. So assuming at least a lexical analyser that will chew on Ruby program text and spit out an Array of Symbols, Numbers and Strings.... Q1a) What would be the Ruby0 language? ie. What is the smallest subset of Ruby that could be used to write a self-interpreting interpreter. Q1b) Could there be a way of hijacking the Ruby internal lexer to cough up such an Array of Objects? Q1c) What would be the RubyLex0 definition? (The simplist subset of Ruby lexical analysis that could be used as a front end to a Ruby0 interpreter) 2) A major gotcha is Regular Expressions are a "language within a language". 2a) It would be a fun thing to do to create a Ruby Regex to Ruby compiler - and then extend the semantics hugely. 2b) What would be the simplist Ruby0 in Ruby0 definition _including_ the lexical analysis from text? John Carter Phone : (64)(3) 358 6639 Tait Electronics Fax : (64)(3) 359 4632 PO Box 1645 Christchurch Email : john.carter@tait.co.nz New Zealand