I'm now working on the compiler. I also want to add support for globabl variables in DruinkScript, which should be easy - globals can just be stuffed in at the base of the stack.
Anyway, DruinkScript is going to be strongly typed, and look pretty much like C / C++. Here's my current script:
// Test.dsc Test file
const int g_nConst = 10 * 5;
int Add(int a, int b)
return a + b;
int foo = Add(5, 0x1f & 1111b) + g_nConst;
string pies = "I like " "pies" + "lots";
pies += ". Really.";
string foo = pies.left(6);
The only two things valid at global scope are functions and the declaration of constants. Constants get evaluated at compile time on the first pass of the code, when they get added to the symbol table.
"Member functions" will be a bit of a hack. Since the compiler will know the type of the variable to the left of the . operator, it can convert the function call into an opcode. In the above case, it'll see that pies is a string, and lookup string's list of members. Left() will resolve to a strleft opcode.
I can also add members to float and int (The other two types supported) for things like absolute value and other hilarity. Although that's likely to get confusing...
I need to re-read the bit in Game Scripting mastery about making expressions ("1 + 5 * 7 / 4 + 7" and the like), so I can use that all over the place. I also need to read up on BNF notation a little to define a formal grammar for DruinkScript.
P.S. I have a pinecone where my penis should be.