heh! well everyone was busy working on icfp or something, so the newsgroup was pretty dead :-) And I played with opengl a little, which gave better results than I thought, but not good enough to pursue, and the whole program was in imperative "do"s anyway, so I couldnt quite see what was the point of moving to a non-imperative language!
<br><br>End of rant... <br><br>It looks like there's a huge amount of documentation on the parsing process, but it's kindof more fun to just figure it out ourselves, I think?<br><br>Anyway, for handling loops, what I'm thinking is maybe the Map that holds variables, rather than holding a "Double" type should hold a "variant" type, something like:
<br><br>data Variant = VDouble Double | VString String | ... etc...<br><br>then, to handle loops, which basically involves creating a "pointer" variable, we simply add a variant type that holds a program:<br><br>
data Variant = ... | VProgram Program<br><br>... and then we can just assign to the Variant type in the map corresponding to the symbol the rest of the program that follows that symbol.<br><br>Note that we have to reverse the Program data type to get this to work effectively:
<br><br><span class="q">data Program = ProgramLeaf Statement | ProgramTree Statement</span><span class="q"> Program</span><br><span class="q"> deriving(Show)</span><br><br>... errr... I think... because that way we can grab any part of the program tree and store that as a Variant in the map.
<br><br>How does that sound? That ought to get looping working? Then we just have to handle conditionals, which I havent thought at all about yet.<br><br>