Worklog for Orca

Worklog 1

Return to Worklogs

Comments(Posted 2006-02-06)
No major progress to report, but every little improvement adds up over time.

"stoopidcc" now supports
- comments
- multiple statements on a single line

'this is a comment

'declare some variables
var lives = 100, score = 0; var time = 0
var bonus

'do some calculations here
bonus = 1000
score = score

print bonus 'print is parsable, but does nothing right now..


print keyword is legal, but does nothing at the moment. I still havent added real code generation..its also a just a temp keyword.

Other minor happenings:
-now under version control
-split into multiple files
-I started rolling my own console thru WriteConsole, since blitzplus's has annoying behaviour, but it isn't quite working yet. Not real sure why, but cba right now.

Would like to add more tonight but I've gotta hurry up and get Supergrafx out the door, as well as continue with my game :X


*Orca steps into the shadows and dissappears..


------------------------------------
"Fall down seven times, get up eight."
http://devblog.timbarela.com

First Steps(Posted 2006-01-30)
Well, for 4 hours worth of work, I'm pretty pleased.

"stoopid compiler" ( tentative title ) can
-declare and assign variables
-reject non declared variables

This is a valid program:
var name, x, y
var score = 0, lives = 99

var apple = 1, orange

var cat = 1, dog = cat

x = y
orange = apple



I know, it doesn't look like much, but I'm handcrafting this, as opposed to using a compiler generation tool. Its a decent amount of work( well about 4 hours worth this time ).

One can probably come up with some quick and dirty ways to parse and translate ^that^, but hacks won't really workout in the longhaul. I've had a few other attempts at compilers, and the code can get gnarly and out of control real quick, if you dont keep it in check.

And I've still got plenty of things to add. The stuff that really makes a compiler a "compiler"... Putting in some quicky hack just wont work. Nope. I'm doin it proper. Well mostly. I'm doing 2 passes, 1 for scanning the source and creating a tokenized "stream", and then another pass which parses the tokens and generates the code. I've yet to see the need for a parse/abstract syntax tree ...but I'm still n00b at this ^_^

I've learned a bunch from my previous attempts, and I feel more comfortable this time around. Its going much faster and smoother.

Long term plan is to slowly build it in blitz, until it is self hosting..The language I envision is sort of a middleground between c and basic. Best of both worlds.

I should probably be doing this in c#, but I've had this itch to do a large-ish project in blitz, something that would be kinda cool to say "I made that". I've written a lot of code in blitz over the years, but most of it hasn't been seen by anyone besides myself, which is a bummer. I also thought about doing a console emulator....

Hmmmmm.... Maybe I'll do both o_O

...Anyways went off on a tangent, next steps:

-Expressions... right now they only consist of either a variable or a number.. no add ops or anything of the sort
-Code generation
-Print keyword - just a temporary keyword so I can get some output, since I dont have function calls yet.
-"If" construct.. need to control program flow

This is my fun project though, so probably gonna be a weekend thing.

Stay tuned.


------------------------------------
"Fall down seven times, get up eight."
http://devblog.timbarela.com