Hi Allison, Thank you very much for your response. I am still having problems but I will work on those myself for a while. If I have any other questions, I will post them to the main parrot list. Thank you again.
Chris On 6/5/07, Allison Randal <[EMAIL PROTECTED]> wrote:
Chris Yocum wrote: > Hi Everyone, > I am not sure if this is the correct list to post this problem to > but I will try here first. The main Parrot list is better for anything not specifically related to the Perl 6 compiler. > I am having a problem with understanding > TGE and I was hoping someone might be able to give me some help. I am > writing a parrot version of 1964 BASIC using the compiler tools and I > have the PGE part nearly complete (there are a few things that I need > to finish though) and I was looking forward to using TGE but I have > become stuck. > My problem is that when I get through the first two parts of the > tree, I come to a point where things come to a screeching halt because > the node (in Basic64::Grammar::statement) does not seem to be anything > at all or anything that I can identify. I know from the parse output > that Basic64::Grammar::statement is a ResizablePMCArray (size:1) but I > am not sure how to reflect that in PIR or if that is even significant > here. Underneath that are the linenumber and statement_type rules but > I cannot seem to access them at all. > I apologize in advance if this is something simple but any help > would be greatly appreciated. If you can have more than one element in the statement array (I expect you can) in the rule for Basic64::Grammar::statements, you need to grab the array, and iterate over it, calling tree.'get' on each element of the array. As an example, take a look at the PunieGrammar::lineseq rule in languages/punie/lib/ASTGrammar.tg. If you can only ever have one statement (unlikely, but I mention it in case it's useful for other rules), then you can just grab the first item in the array (e.g. "cnode[0]") and pass that to tree.'get'. (And thanks for the details you provided with the question. They made it easy to see the answer.) Allison