From: Ken A. <kan...@bb...> - 2004-11-22 19:19:25
|
Yes, you should subclass Pair. THere is a jscheme.SchemePair interface but the jsint package doesn't really use it, which it should. We should also make SchemePair extend collection. You'll need to cast (Symbol)x.getFirst(), but won't you be just constructing lists? I'd write some utility functions to help you. Can you put together an example of what you're doing? We can make it part of our documentation. k At 09:04 PM 11/20/2004 +0000, Peter Harman wrote: >Hi, > >A while ago I mentioned that I was using JScheme together with Antlr (<http://www.antlr.org>http://www.antlr.org). My current code is a bit of a fudge, using Antlr to generate a Scheme 'String', which I evalute. However I'm looking to generate a class extending jsint.Pair and implementing antlr.collections.AST (the Abstract Syntax Tree interface) which should make a very powerful tool for language implementation. > >My question is, what does my class (call it ASTPair) need to do to convince the Scheme interpreter that it is really a 'Pair'? The main issue is, how does the Pair relate to a Symbol - as with an AST every element is of the AST class, so for the 'first()' and 'getFirst()' methods of 'Pair' would I sometimes need to cast to a 'Symbol'? > >thanks > >Peter > |