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

while (I was away)

Sign in to follow this  



I implemented the while loop statement today. It functions the same way as the C while statement. Again braces are required for the code block and within the code block is a temporary scope for variable declaration. I tested it with this bit of code using nested 'whiles' and an 'if' statement.

int x = 0;
while(x < 3)
int y = 0;
while(y < 2)
y = y + 1;
print x;
if(x == 1)
print "One";
x = x + 1;

Output: 0 0 1 One 1 One 2 2

Next up...

Arnold tells Willis that he knows Mr. T but really...


I'll work on adding functions to the language. The entry point will be a main function just like C. I'm hoping to add recursive functionality. Then I'll want to be able to bind C functions to the language. After this is all working I'll finish up on the types and add structs.

Another name...

The working title for this language is Magus. That name sucks. Any ideas?
Sign in to follow this  


Recommended Comments

I somehow missed your best post ever, the one about your son's first program! How touching.. *wipes tears from eyes* Mine was "You see a door, what do you do?" or "how old are you?" or something... How old is he?

btw, I could not have come up with better options for the posed question had I tried. I despise checkers...

sorry for the off topic, to reamin on track: how about 'Y'? No? Okay, at least i tried :P.

Share this comment

Link to comment
How old is he?
Brandon is 10.
how about 'Y'?
If you're talking about the name then maybe we should call is 'Ynot' [smile] else I don't know what you're talking about.
I am a barbaloot, I lost my home :(
That's so sad. I hope you find a new one.

Share this comment

Link to comment
Feel the power of scripting! I'm assuming this is interpreted? How are script errors controled?

Share this comment

Link to comment
I'm assuming this is interpreted? How are script errors controlled?
That is a correct assumption. Right now I am keeping an execution log that tracks errors and warnings. If an error is encountered during execution then it exits the script. Warnings, such as type conversion, are ignored. So far my main pieces are the tokenizer and the parser/interpreter. All errors are caught in the parsing section. Currently I'm adding a second pre-processor to build a function table - certain function related errors and warnings will be reported in this step as well.

Share this comment

Link to comment

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!