-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A modest proposal #113
base: main
Are you sure you want to change the base?
A modest proposal #113
Conversation
I was talking to Pierce about this... did you chat with him? Overall, I like this, although I think it may break down when we get to things like Fraud since the methods for earlier languages would need to be replaced with ones that accept (and pass along) the static environment. I also want to be able to generate stand-alone compilers and I don't see how to do this. I think what's needed is something that's more like a meta-language for writing incrementally extensible programs. Maybe something like that exists, or maybe we should think about making our own. |
Yeah, after our meeting yesterday I walked out of the building with @laelath and we talked about this. Turns out I accidentally nerdsniped him haha. Definitely see your point about a metalanguage for generating this stuff. Although @laelath's implementation would probably be fine to maintain for one individual, I could imagine it being difficult for students to come in and see a late-stage language definition and understand everything that's going on. We talked a bit about possible metalanguage implementations, but I think having a starting point for an OO approach will be helpful in deciding how the final thing ought to look. |
Also, it seems a bit weird not to use the AST for the class hierarchy. Being object-oriented means never have to say
etc. This helps with the stand-alone thing because you can get earlier langs by simply omitting some class definitions, at least for the simple cases. You still have the problem of the signatures changing over time with variables, tail calls, etc. |
OK, one more note about this: either you give up on bootstrapping, or you have to implement the class system ;) |
I think that all the problems can be addressed (though the extra args in fraud probably requires restarting the inheritance chain) except for needing to extract a compiler for each stage, which definitely needs a metalanguage to specify. As for making exprs objects too... I have no good reason other than that that just feels wrong™️. For implementing the class system, I would simply introduce macros, and then classes are easy :) |
I want to make some handwavy argument about language specifications being positive constructs and so more naturally represented as positive sum types rather than negative objects |
Okay okay, when you define AST nodes as objects, you're saying that the meaning of the AST nodes is the result of making the 'compile' observation on it, when I would argue that morally, ASTs are just some data to be interpreted in whatever way is needed. This can be seen by how |
Restructure compiler to use objects to avoid so much copying between languages.
There's a significant catch in that extracting a full compiler to give to students for assignments is now non-trivial.