Quick Basic Compatible Compiler
-------------------------------

Well, here it is, the big part of the whole compiler. I've tried to modulerise it as much as possible by seperating each token type into a seperate file. Each file (eg. variable.c, function.c etc) parses the token accordingly.

The heart of the compiler lies in translate.c. It's very messy and i wouldn't recommend playing with it unless you know how it works properly. Maybe for the full version i'll re-code major parts of the file.

The theory of the compiler is basically the Block function gets called. This parses a token and handles it appropriatly. After the translation of a token, execution will get back to block at the end of the line (or softline ':'). It's basically a line-by-line parser, for a line-by-line language :) Expression is also another major function. Expression basically translates an expression from simple adding to complex formula's. Assign is for the lvalue assignments (eg var1 = 1 + 2). Assign _should_ use expression, but it doesn't and instead parses the whole line itself because of some differences between assignments and expressions. (eg pointers)

The rest of the compiler should be relatively easy to understand. (If you can understand the above explanation, you will be fine:)

As with the pre-processor, if you plan on changing the token parser, you'll need to edit the lex.L file, and re-build it with flex again.


For those interested in why I used flex(lex), but no bison (yacc) here's why:
Bison (yacc) parses expression's on a reduction/shift system. That is, it handles simple formula's (eg 1 + 1) throughout a complex forumlua. I didn't know if it could just parse the expression as-is because i didn't want to translate each simple expression, that's for the C compiler to do. All I wanted to do was parse the expression token by token from left to right translating it as i go through it. So i decided against bison (yacc) and opted for lex on it's own as a lexical scanner.

TODO:
-----
The TODO list is way to big to list here, but some of the major things that need to be done are:
* Better error checking
* Support more keywords
* Support more functions


-JasonB