>----- Original Message ----- >From: "Mathieu Bouchard" <matju / sympatico.ca> > >On Mon, 11 Jun 2001, Wayne Blair wrote: > > Is having two mechanisms for parsing not less simple than > > having the entire grammar described for the first level parser? > > There's only one level of parsing. The grammar defines what is valid > to-be-parsed-code, the AST schema defines that is valid parsed-code. > > > Or is your draft just to describe the concrete nodes that would be > > parsed/interpreted by an implementation in a different language, like most > > DOM implementations? > > The metatype classes are going to be the "DOM implementation", and are not > written yet. The definitions specific to Ruby are going to be a "schema" > or "dtd" that is relevant to Ruby in particular. > > > If this is the case, I assume the ast definition is > > not intended for use by the initial parser/interpreter, > > Well, those class definitions have to be put somewhere, so if you don't > bootstrap RubyAST or otherwise convert it to Java, you'll have to write a > lot of dummy code in Java. > > > This would mean that the ast definition or schema is > > only useful for post parsing utilities or interpreted interpreters and > > documentation?? > > Well, that would already be a big step, but I wish the schema to be as > useful as possible =) > It looks like, given these goals, that the schema would be ideally generated by the compiler compiler of choice as the parser is generated. With the meta-generator for the schema definition file built into the grammar definitions, it could potentially be maintained in one place. (I say potentially, because in all likelyhood, the class definitions for both parser and schema nodes would probably need to be maintained by hand outside of the grammar files.) Wayne