Hotel at day 6 - function calling
Did nothing on hotel day 5; except to think about it. On day 6 in the evening I completed the parser for functions and after some refactoring it kindof just worked. Next I should work out arguments to functions and that should enable some basics like fibonacci. That would really be a first milestone.
Second stop would be completing the lexer and adding a rich messaging infrastructure to the parser. Currently a syntax error is an assert("Syntax Error: expected ')'" == 0);. Having better infrastructure should help me complete the parser sooner. Also needed is fully implemented control structures like if and else and while, for. I'm hoping that from there on adding features will be more of a linear process.
Criticism
Some have been wondering the logic behind yet another programming language? Especially if it is going to be much like python, ruby, lua, or javascript. One answer is: what is the logic behind yet another website/game/x/y/z? For a large part it is the trying and the learning. A second part is the hope that maybe someday, I can program in a language designed just for me. Besides, it is my time and I get to chooce what to do with it.
Another answer is that hotel can be contrasted to all of the above to see the difference.
Instead of lua wich comes without objects, hotel adds syntax sugar to support regarding scopes as objects; But instead of python and ruby there are no classes, and no modules. They all have been merged into the same thing, a scope. A scope can be a module, an object or just a place where you put your code. Basically a scope encapsulates data and functions, just like objects do, and just like modules do. And instead of javascript there are no prototypes in hotel, otherwise it comes pretty close, but hotel adds syntax sugar for statements like function(){ ... private namespace ...}() which you need, and see a lot, in modern javascript libraries.
The thing is almost all programming languages are turing complete, that means you can express any program in any language; the question is how easy it is to do?
For hotel I try to keep the language as simple as possible, keep the amount of invisible magic to a minimum. If you want to really know hotel inside and out, that should only require you to be able to reason about a few basics and some simple rules.
Plus, for something you don't see in these mainstream languages, I'm keen on adding symbolic programming and pattern matching. And with that probably some light typing. Though these features will be fully integrated, they can be regarded as an addon: you don't need to know these to program in hotel, though they will help to get things done faster and easier. There is not going to be type interference though, that implies a static language.
And as a last feature I would want to add support for extending the lexer/parser by bringing your own, basically to allow things like LINK and E4X and such features.
However for now hotel is all vaporware, so whatever you read here is subject to change or fail.
open source?
Ofcourse, so where is the source ... it is upcoming. Once the code base has settled down a bit I'll publish it. Publishing it now would satisfy curiosity of others, but also waste time, both mine and whoever looks at it, because tomorrow it might all look different. With 1358 lines of c code it is just not large enough for more then one guy to work on it.
Last modified: 2007-11-19 20:18 GMT