Not a lot initially. I did have a look at the LLVM tutorial, which is absolutely great, but I eventually closed that tab because I found it more exciting to think about these problems by myself (instead of devoting resources to always figuring out "why did they do it this way?"). It probably took a lot longer, but it was also a better learning experience. There is nothing fundamentally magic about this, one simply has to go ahead an do it.
It's a mixed bag, because I can feel there are a lot of inefficiencies in my code that exist either because I personally find it more readable or simply because I couldn't quite grasp the alternative at the time.
> Also, what was your experience with language design before going into this project?
None, that's a big reason why I wanted to do this. I did make a tool for pen&paper roleplaying before that could execute standard dice codes (http://rolz.org/) but that's nothing like this project. Over the years I made several domain-specific "configuration" languages for some projects, but again, this was different.
It did help a lot to break down the process into distinct steps that have almost no overlap. A lexer to convert a string of tokens, a parser to build a tree, an interpreter to execute that tree in place (not the most efficient thing to do but it was a lot of fun), and a minimal runtime library on top of it. For the runtime functions I did cheat a little, however, because there are a lot of Apache Commons function wrappers in there.
There were some decisions of probably questionable value. For example, when I decided that the language would have no commas and would use whitespace as a generic token separator. It's been surprising sometimes to deal with the consequences of those early decisions.
One of the things that surprised me was that despite the total absence of optimization, np doesn't execute abysmally slow. When I was banging out the code I was convinced it would degrade to C64-like performance levels ;)
I'm actually planning to add more functionality, as I've hinted at in the tutorial, up to the point where someone could conceivably do a web project with it. That someone will probably be me ;)
Udo|13 years ago
Not a lot initially. I did have a look at the LLVM tutorial, which is absolutely great, but I eventually closed that tab because I found it more exciting to think about these problems by myself (instead of devoting resources to always figuring out "why did they do it this way?"). It probably took a lot longer, but it was also a better learning experience. There is nothing fundamentally magic about this, one simply has to go ahead an do it.
It's a mixed bag, because I can feel there are a lot of inefficiencies in my code that exist either because I personally find it more readable or simply because I couldn't quite grasp the alternative at the time.
> Also, what was your experience with language design before going into this project?
None, that's a big reason why I wanted to do this. I did make a tool for pen&paper roleplaying before that could execute standard dice codes (http://rolz.org/) but that's nothing like this project. Over the years I made several domain-specific "configuration" languages for some projects, but again, this was different.
It did help a lot to break down the process into distinct steps that have almost no overlap. A lexer to convert a string of tokens, a parser to build a tree, an interpreter to execute that tree in place (not the most efficient thing to do but it was a lot of fun), and a minimal runtime library on top of it. For the runtime functions I did cheat a little, however, because there are a lot of Apache Commons function wrappers in there.
There were some decisions of probably questionable value. For example, when I decided that the language would have no commas and would use whitespace as a generic token separator. It's been surprising sometimes to deal with the consequences of those early decisions.
One of the things that surprised me was that despite the total absence of optimization, np doesn't execute abysmally slow. When I was banging out the code I was convinced it would degrade to C64-like performance levels ;)
I'm actually planning to add more functionality, as I've hinted at in the tutorial, up to the point where someone could conceivably do a web project with it. That someone will probably be me ;)