Archive for December, 2007

Shading Language -> Lisp

Bwain| No Comments »

FINISHED the assignments, which is the last feature I needed to implement before going onto loops/if-else, and other control flow commands. Introducing control flow takes the shading language into a new level of functionality. This is a significant step closer to doing a full featured fractal renderer.

I’ve been also distracting myself with OO scripting languages such as python and io. I’m fighting the urge to utilize these existing languages since I’m already implementing my own. But the higher level OO features are such a plus. Implementing them myself into the grammar would be rather difficult. And it would be somewhat counterproductive to its original design which is a fast shading language, not an OO analysis tool.

So I’ve also been looking at Lisp. I even got a copy of the original MIT Lisp Manual from 1965. What’s fascinating about Lisp is how little the operating kernel requires to function. The core of the language is recursive. The parsed program, and the data are the same. Implementing it *almost* seems possible. I’m going to obsess over it for a few more weeks, and see if I can’t get my head around implementing it. It would seem to be a fair delegation of tasks. The shading language would still reside as the ‘dumb’ workhorse. Lisp could function on a higher level. I have to admit, I’m not a fan of the syntax, but I would be receiving ALL of the object oriented features for free, and with a minimum of pain in implementation. I would also have an analysis tool for doing numerics, or any obscure analysis that would be required.

We’ll see….

Actually, I just found this little gem, which goes into the different flavors of lisp, scheme, their variants, and details on their implementations. I think I’ve found my winter reading….

Kill For-Loops

Bwain| No Comments »

For loops are parsed, whats left is the assembly code generation. I had to get labels put into the assembly grammar. Now we need some basic jump instructions. Don’t know whether I should have the addresses relative or absolute. Maybe have different instructions for each case. Its quite possible that I never write something requiring 2^31 instructions. Should try absolute addressing first.

  • jmp addr - Jump to ‘addr’.
  • update_flags_branch_Zero oldBoolTmp newBoolTmp branchLabel: - Compares newBoolTmp to oldBoolTmp. If they are different (XOR), then we enable/disable the proc. If all newBool values are false, then branch.
  • jmpZero boolTmp addr - Jumps to ‘addr’ if boolTmp (varying or uniform) is all zeros.

These should be enough to implement full functionality for a for loop.

Pseudocode

  • doInit;
  • false -> tmpBoolOld; false -> tmpBoolNew;
  • beginLabel:
  • testExp -> tmpBoolNew;
  • updateFlagsBranchZero tmpBoolOld tmpBoolNew endLabel;
  • doBody;
  • doUpdate;
  • jmp BeginLabel:
  • endLabel:

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