Archive for January, 2009

Autodefine variables

Bwain| No Comments »

Since I’m compiling real world shaders now, I’m dealing with all kinds of sloppy coding. I need a mechanism for allowing a variable to be autodefined if its referred to, but doesn’t exist yet. Currently, I’m parsing out the ‘=’, and checking to see if the variable before it is defined. This is a hack. Also wont work for other cases where the user is allowed to have expr,expr,expr on the same line.

Just have to add a callback to the symbol table I guess, but I had to write this out anyway…

Haven’t reported on the blog for a while. I’ve been taking care of a LOT of compiler issues. Some are bullshit error tolerance for shitty code, some were serious grammar issues that needed to be corrected. It turns out that the unary operators (! - ++ — ) were at an incorrect precedence. So certain expressions would compile incorrectly, some wouldn’t compile at all. I’m glad I’m getting a chance to bang out a lot of these features. I feel like I’m bulletproofing the compiler and the grammar. Its also good to be repurposing the shading language in this way. It reinforces the idea that a grammar and its code really can be re-used.

Anyway, I’m burning through all these formula files. Pretty soon, I’ll get to more rendering instead of grammar debugging.


Copyright © 2010 Luna-Canis | Created by miloIIIIVII
Top | Sidebar | Sitemap | Disclaimer | Network