The following is a short and drafted schedule for the POOL project, it doesn’t contain any dates and should only give an idea, what I’m going to do next in the project and what I’ve already done.
Create a draft of the syntax (I’ve to admit that I’m currently working on the class syntax and on the variable container syntax)
Publish the draft
Figure out the core libraries (like System, etc.)
Parser grammar, which produces the AST
Tree filters to optimize and annotate the AST (convert for example 2+3 to 5)
Tree based interpreter
Objects, scope, functions, etc.
Tree based interpretation
Optimization of the interpreter
More built in libraries
Language manual with lot’s of example code and a website as I think the project will (after creating a tree based interpreter) more than half a year old.
Byte code based interpreter aka Virtual Machine
Byte code compiler
Byte code interpreter aka VM
- parallelize the variable lookup
- e.g. one thread for the backward module chain one for the forward and one for the class chain
- cache the variable already looked up
- probably with a hashtable and a global `no_attribute_added` flag
- force spaces (when it's neccessary)
- trim the syntax spec and extend it later - to make you're that the grammar can be written at one or two weekends
- first thing to do after finishing a running draft of the parser and the vm ist to build a website
- create an http://tryruby.org like interface with www.masswerk.at/termlib/
- create pool highlighter support for SciTE and a web syntax highlighter (e.g. http://prismjs.com/)
#Plans for the future
The aim is now to get something running, that means that I'm going to focus on a subset of the syntax and the features and create a first draft (or base language). Otherwise the probability is high, that I'm going to abandon this project.
I focus during the next month on the implementation and creation of the following:
- simplified grammar and parser via ANTLR 3
- bytecode compiler (using a bytecode based on JSON: although it's very verbose, I use it because it's easy to implement)
- VM without any performance optimizations or advanced features of the language (like some OO features)
- highlighter support for some editors and webpage highlighters (see above)
- webpage (see above), with a simple tutorial
After I've finished with all this, it's probably 2014...
I’m going to post some example code snippets, like the following, written in POOL to demonstrate some of POOLs cool features and to have some test code when I’m writing the parser and the interpreter.
This code snippet eveluates the fibonacci sequence recursively, using the memoizing features of the special function type
sef_function to avoid on the usual drawbacks of recursive evaluation: the multiple calculation of the same value.
fibonacci(n - 1) + fibonacci(n - 2)
fibonacci(0) = 0
fibonnaci(1) = 1
fibonacci(5) #-> 5
/* Call stack of fibonacci(5):
-> fibonacci(4) + fibonacci(3)
-> (fibonacci(3) + fibonacci(2)) + fibonacci(3)
-> ((fibonacci(2) + fibonacci(1)) + fibonacci(2)) + fibonacci(3)
-> (((fibonacci(1) + fibonacci(0)) + fibonacci(1)) + fibonacci(2)) + fibonacci(3)
-> (((1 + 0) + 1) + fibonacci(2)) + fibonacci(3)
-> ((1 + 1) + 1) + fibonacci(3)
-> (2 + 1) + 2
-> 3 + 2
-> 5 */