From: Mathieu Bouchard Date: 2001-10-28T23:00:21+09:00 Subject: [ruby-talk:23682] Re: [ANN] RubyInRubyParser 0.1-pre-alpha On Fri, 26 Oct 2001, Robert Feldt wrote: > On Fri, 26 Oct 2001, Mathieu Bouchard wrote: > Some q's though: > * Is Tuple the place to add methods I want all "nodes" in the AST to have? Well, Tuple is outside of the AST system, so adding to it will also add to every other program using Tuple; for example, most classes in RubyX11 inherit from Tuple. (except that RubyX11 still has its own copy of Type.rb with X11:: prefixes...) > * Maybe have all schemas derive from RubySchema and then have > class RubySchema < Tuple; end > since Tuple is too general in this context? Or include empty RubySchema > module? Anyway, we should have a way to add to all RubySchemas/Ast nodes > without having to add to tuple. A "Schema" module is a set of class definitions, type definitions, module inclusions, etc. such that as a whole it describes a syntaxless language. A "Schema" gets not instantiated. Every Schema would have its type constraint on toplevel nodes. I don't know how I'd specify that in code. For now, in RubySchema, Body would be a good toplevel node, but I'm not sure it's the only such node that can reasonably be produced by a parser. > * IMHO, maybe we should avoid too short names (like M) and call the > RubySchemas by their "full" name (M => Message, IVar => InstanceVariable > etc) and then have the shorthands be aliases (M = Message etc)? Makes > things self-descriptive even if your new to them and if this will be a > "standard" way of representing parsed Ruby programs it might affect not > only the "internals hackers"... I'll think about this one. However, M is not a message in the strict sense; it's a message expression; so to evaluate it you have to first evaluate its subcomponents and construct a real message from it, and then evaluate that message. > * Is schema commonly used in this context? Is it from Lisp? I'm more used > to "Term"... Tuple (now called Form, if you're getting metaruby from the cvs) is possibly like the Term you're talking about. "Schema" is terminology I borrowed from XML to say "a specialized language defined in terms of data structures instead of sequences of characters". No special relationship to the Scheme language. (But I intend to use a Lisp-like syntax as a notation for data structures eventually) ________________________________________________________________ Mathieu Bouchard http://hostname.2y.net/~matju