コード例 #1
0
 public void InsertConstants()
 {
     InsertStringInHeap("true");
     TrueAddress = Image.GetLastHeapAddress();
     StaticTemp.NewStaticEntry("true", TrueAddress, "pointer", 0);
     InsertStringInHeap("false");
     FalseAddress = Image.GetLastHeapAddress();
     StaticTemp.NewStaticEntry("false", FalseAddress, "pointer", 0);
     Image.AllocateBytesInHeap(1);
     AdditionAddress = Image.GetLastHeapAddress();
     StaticTemp.NewStaticEntry("addition", AdditionAddress, "pointer", 0);
     Image.AllocateBytesInHeap(1);
     TermAddress = Image.GetLastHeapAddress();
     StaticTemp.NewStaticEntry("term", TermAddress, "pointer", 0);
     Image.AllocateBytesInHeap(1);
     ConditionResultAddress = Image.GetLastHeapAddress();
     StaticTemp.NewStaticEntry("conditional", ConditionResultAddress, "pointer", 0);
 }
コード例 #2
0
        public void HandleVarDecl(ASTNode node)
        {
            Image.WriteByte("A9");
            Image.WriteByte("00");
            string varType  = node.Descendants[0].Token.Text;
            string varName  = node.Descendants[1].Token.Text;
            int    varScope = SemanticAnalyser.VariableChecker.FindSymbol(node.Descendants[1], node.AppearsInScope);

            node.Visited = true;
            node.Descendants[0].Visited = true;
            node.Descendants[1].Visited = true;
            string[] tempAddressBytes = new string[2];
            StaticTemp.NewStaticEntry(varName, "00", varType, varScope);
            tempAddressBytes = StaticTemp.GetTempTableEntry(varName, varScope).Address.Split(" ");
            Image.WriteByte("8D");
            Image.WriteByte(tempAddressBytes[0]);
            Image.WriteByte(tempAddressBytes[1]);
        }