while (I was away)

posted in noaktree leaves
Published July 06, 2005
Advertisement
Loop-d-loo...

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...

Then...

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?
Previous Entry If else
0 likes 5 comments

Comments

Daerax
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.
July 06, 2005 08:44 PM
The Forgotten Mindset
I am a barbaloot, I lost my home :(
July 06, 2005 09:49 PM
noaktree
Quote:How old is he?
Brandon is 10.
Quote: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.
Quote:I am a barbaloot, I lost my home :(
That's so sad. I hope you find a new one.
July 07, 2005 08:47 AM
Rob Loach
Feel the power of scripting! I'm assuming this is interpreted? How are script errors controled?
July 07, 2005 11:22 AM
noaktree
Quote: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.
July 07, 2005 12:28 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement