3 ms·
You are right, people would be interested to implement a real compiler for an actual language. I have tried it. But when you actually sit down to implement, it
by bootcat 9y ago
You are right, people would be interested to implement a real compiler for an actual language.
I have tried it.
But when you actually sit down to implement, its atleast months.
But if you choose a simple language, you can get the entire compiler done in perhaps a week/month at most.
Indeed, that prepares you for implementing an actual language. My 2 cents, what do you think ?
- jetti 9y agoSomething like C could be seen as a simple language. You don't have to do everything in the language and you don't have to handle the edge cases. But being able to use functions and variables would be awesome and I would totally pay for something like that.
- bootcat 9y agoI would consider Java to be simpler, but i see this is subjective and C seems like a popular language to proceed with. In java most of functionality we need is available as standard library.
- jetti 9y agoDepends on the target. It would be much harder to implement Java with a assembly target and some of the standard library because you would have to implement that from scratch. Not only that, but you have to deal with vtables from inheritance and class layouts. C doesn't require any of that complexity. That being said, I think it would be very valuable to see somebody implement at least a partial version of Java with standard library (such as generics or at least collections) with assembly as the target.
- bootcat 9y agoSorry i did not completely understand your comment. You mean to say, to implement a subset of C. I have already answered that question. Before we implement a real language or a part of it, implementing mathematical expressions has to come in place with actual code. Reason is, before we jump to implementing an actual language, we can learn all the phases of a compiler, simply compiling expressions into assembly. Extrapolating, we can implement a subset of C, which is not easy to begin with, but with experience, it is achievable.