Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views


Sign in to follow this  
Evil Steve


Ok, I've leaving the debugger for now. I may come back to it later on.

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;

void _Main()
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.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!