M
metaperl
Ok, I have been using SableCC (http://www.SableCC) to develop an
interpreter for a scheme-like language. In fact, a language with J
(http://www.JSoftware.com) language semantics, but scheme syntax.
So, if you check out the HEAD:
svn checkout http://redick.googlecode.com/svn/trunk/ redick
and follow the build/install instructions:
http://code.google.com/p/redick/wiki/DeveloperWelcome
then you have an interpreter which works.
Now, I have several future goals, but my instinct tells me the next
thing to do is implement a hierarchy of types. I have studied the
design document for Norvig's Jscheme -
http://norvig.com/jscheme-design.html
but am leaning towards the decision he chose not to make. I want to
make a base LispObject class and then use composition on Java types
to extend and customize them.
I'm not sure why I'm opting for that, but it just seems more
sensible.
That being said, my instincts are further guiding me to the idea that
having LispString, LispDouble, etc is a violation of DRY and that
I need some sort of package for my datatypes. And that is where I am
hitting the wall.
Should I do something like:
package redick.types;
public abstract class LispObject {
Object val;
java.lang.String toString ();
}
public class String {
java.lang.String toString () {
return ("'" + (String)val + "'");
}
}
So, I do want to be able to call Java methods, but I dont see why
Norvig thought that would be harder with the LispObject approach as
opposed to trying to hijack Java types like he did.
Any feedback on which typing approach is better is appreciated.
I think SICP is a good enough guide to how to write an interpreter. I
understand Section 3.2 on how to create environments for expression
evaluation and will be doing that shortly after I get the type system
locked down.
Of course any other feedback is welcome too.
interpreter for a scheme-like language. In fact, a language with J
(http://www.JSoftware.com) language semantics, but scheme syntax.
So, if you check out the HEAD:
svn checkout http://redick.googlecode.com/svn/trunk/ redick
and follow the build/install instructions:
http://code.google.com/p/redick/wiki/DeveloperWelcome
then you have an interpreter which works.
Now, I have several future goals, but my instinct tells me the next
thing to do is implement a hierarchy of types. I have studied the
design document for Norvig's Jscheme -
http://norvig.com/jscheme-design.html
but am leaning towards the decision he chose not to make. I want to
make a base LispObject class and then use composition on Java types
to extend and customize them.
I'm not sure why I'm opting for that, but it just seems more
sensible.
That being said, my instincts are further guiding me to the idea that
having LispString, LispDouble, etc is a violation of DRY and that
I need some sort of package for my datatypes. And that is where I am
hitting the wall.
Should I do something like:
package redick.types;
public abstract class LispObject {
Object val;
java.lang.String toString ();
}
public class String {
java.lang.String toString () {
return ("'" + (String)val + "'");
}
}
So, I do want to be able to call Java methods, but I dont see why
Norvig thought that would be harder with the LispObject approach as
opposed to trying to hijack Java types like he did.
Any feedback on which typing approach is better is appreciated.
I think SICP is a good enough guide to how to write an interpreter. I
understand Section 3.2 on how to create environments for expression
evaluation and will be doing that shortly after I get the type system
locked down.
Of course any other feedback is welcome too.