Example #1
0
        Expr SubscriptExprs(Expr[] indexExprs, Expr[] dimExprs)
        {
            if (indexExprs == null)
                return null;
            if (indexExprs.Length == 1)
                return indexExprs[0];		// special case: single index is always OK

            if (indexExprs.Length < dimExprs.Length)
            {
                throw new ParseException("Not enough subscripts", indexExprs[indexExprs.Length - 1].Token);
            }
            else if (indexExprs.Length > dimExprs.Length)
            {
                throw new ParseException("Too many subscripts", indexExprs[dimExprs.Length].Token);
            }
            else // indexExprs.Length == dimExprs.Length
            {
                /*        |                   |                  |
                        ind[0]  dim[1] * ind[1] +  dim[2] * ind[2] +   dim[3] * ind[3] +
                     */
                Expr indexExpr = indexExprs[0];
                for (int i = 1; i < indexExprs.Length; ++i)
                {
                    int dim = Expr.EvaluateIntConstant(dimExprs[i]);
                    indexExpr = new BinaryExpr(null, 0xf4, indexExpr, new IntExpr(null, dim));	// mul
                    indexExpr = new BinaryExpr(null, 0xec, indexExpr, indexExprs[i]);				// add
                }
                return indexExpr;
            }
        }
Example #2
0
 public DatOrgEntry(SimpleToken orgToken, Expr orgExpr, int endLineNumber)
 {
     this.orgToken = orgToken;
     this.orgExpr = orgExpr;
     this.endLineNumber = endLineNumber;
 }
Example #3
0
 public ObjSymbolInfo(IdToken idToken, SimpleToken filenameToken, Expr countExpr, bool needsVarSpace)
     : base(idToken)
 {
     this.filenameToken = filenameToken;
     this.countExpr = countExpr;
     this.needsVarSpace = needsVarSpace;
 }
Example #4
0
 public void AddObjSymbol(IdToken idToken, SimpleToken filenameToken, Expr countExpr, bool needsVarSpace)
 {
     AssertUndefined(idToken);
     ObjSymbolInfo objSymbolInfo = new ObjSymbolInfo(idToken, filenameToken, countExpr, needsVarSpace);
     AddSymbolInfo(objSymbolInfo);
     objList.Add(objSymbolInfo);
 }
Example #5
0
 public DatFitEntry(SimpleToken token, Expr e)
 {
     this.token = token;
     this.e = e;
 }
Example #6
0
 public void AddDatFitEntry(SimpleToken token, Expr e)
 {
     datEntryList.Add(new DatFitEntry(token, e));
 }
Example #7
0
 public void AddDatOrgEntry(SimpleToken orgToken, Expr orgExpr, int endLineNumber)
 {
     datEntryList.Add(new DatOrgEntry(orgToken, orgExpr, endLineNumber));
 }
Example #8
0
 public ConverterExpr(SimpleToken token, Expr operand)
     : base(token)
 {
     this.operand = operand;
 }
Example #9
0
 public override Expr Led(Expr left)
 {
     if (CouldBeLvalue(left))
     {
         UnaryExpr u = new UnaryExpr(this, postOpcode, left);
         return u;
     }
     ///		Console.WriteLine("-------------");
     ///		left.Accept( new RPNPrintVisitor() );
     ///		Console.WriteLine();
     ///		Console.WriteLine("-------------");
     throw new ParseException("bad lvalue", this);
 }
Example #10
0
 public CoginewtExpr(SimpleToken token, Expr e0, Expr e1, Expr e2)
     : base(token)
 {
     this.e0 = e0;
     this.e1 = e1;
     this.e2 = e2;
 }
Example #11
0
 public ConstantExpr(SimpleToken token, Expr e)
     : base(token)
 {
     this.e = e;
 }
Example #12
0
 public CaseStmt(SimpleToken token, int endLineNumber, Expr caseExpr, ArrayList matchExprListList, ArrayList matchStmtListList, ArrayList otherStmtList, ArrayList matchTokenList, ArrayList matchEndLineNumberList)
     : base(token, endLineNumber)
 {
     this.caseExpr = caseExpr;
     this.matchExprListList = matchExprListList;
     this.matchStmtListList = matchStmtListList;
     this.otherStmtList = otherStmtList;
     this.matchTokenList = matchTokenList;
     this.matchEndLineNumberList = matchEndLineNumberList;
 }
Example #13
0
 public CallExpr(SimpleToken objectToken, SimpleToken methodToken, Expr indexExpr, ArrayList argList)
     : base(methodToken)
 {
     this.objectToken = objectToken;
     this.indexExpr = indexExpr;
     this.argList = argList;
 }
Example #14
0
 public BinaryExpr(SimpleToken token, int opcode, Expr operand1, Expr operand2)
     : base(token)
 {
     this.opcode = opcode;
     this.operand1 = operand1;
     this.operand2 = operand2;
 }
Example #15
0
 public void AddConSymbol(IdToken idToken, Expr e)
 {
     AssertUndefined(idToken);
     ConSymbolInfo conSymbolInfo = new ConSymbolInfo(idToken, e);
     AddSymbolInfo(conSymbolInfo);
     conList.Add(conSymbolInfo);
 }
Example #16
0
 public static bool CouldBeLvalue(Expr e)
 {
     return e is IdExpr || e is VariableExpr || e is MemoryAccessExpr || e is RegisterExpr || e is SprExpr;
 }
Example #17
0
 public void AddDatDataEntry(int alignment, int size, Expr dataExpr, Expr countExpr, SimpleToken token)
 {
     datEntryList.Add(new DatDataEntry(alignment, size, dataExpr, countExpr, token));
 }
Example #18
0
 public virtual Expr Led(Expr left)
 {
     throw new ParseException("no Led", this);
 }
Example #19
0
 public void AddDatInstructionEntry(IPropInstruction instruction, int cond, Expr eD, Expr eS, bool immediate, int effect, SimpleToken token, int endLineNumber)
 {
     datEntryList.Add(new DatInstructionEntry(instruction, cond, eD, eS, immediate, effect, token, endLineNumber));
 }
Example #20
0
 public PairOfExpr(Expr left, Expr right)
 {
     this.left = left;
     this.right = right;
 }
Example #21
0
 public void AddDatResEntry(SimpleToken resToken, Expr e, int endLineNumber)
 {
     datEntryList.Add(new DatResEntry(resToken, e, endLineNumber));
 }
Example #22
0
 public override Expr Led(Expr left)
 {
     return new BinaryExpr(this, 0xf0, left, ParseExpression(Tokenizer, 10));
 }
Example #23
0
 public DatDataEntry(int alignment, int size, Expr dataExpr, Expr countExpr, SimpleToken token)
 {
     this.alignment = alignment;
     this.size = size;
     this.dataExpr = dataExpr;
     this.countExpr = countExpr;
     this.token = token;
 }
Example #24
0
 public override Expr Led(Expr left)
 {
     if (CouldBeLvalue(left))
     {
         return new BinaryAssignExpr(this, Opcode, left, ParseExpression(Tokenizer, 13));
     }
     else
     {
         throw new ParseException("bad lvalue", this);
     }
 }
Example #25
0
 public DatInstructionEntry(IPropInstruction instruction, int cond, Expr eD, Expr eS, bool immediate, int effect, SimpleToken token, int endLineNumber)
 {
     this.instruction = instruction;
     this.cond = cond;
     this.eD = eD;
     this.eS = eS;
     this.immediate = immediate;
     this.effect = effect;
     this.token = token;
     this.endLineNumber = endLineNumber;
 }
Example #26
0
 public override Expr Led(Expr left)
 {
     return new BinaryExpr(this, Opcode, left, ParseExpression(Tokenizer, Lbp));
 }
Example #27
0
 public DatResEntry(SimpleToken resToken, Expr e, int endLineNumber)
 {
     this.resToken = resToken;
     this.e = e;
     this.endLineNumber = endLineNumber;
 }
Example #28
0
 public void AddBuiltInConSymbol(IdToken idToken, Expr e)
 {
     AssertUndefined(idToken);
     ConSymbolInfo conSymbolInfo = new ConSymbolInfo(idToken, e);
     AddSymbolInfo(conSymbolInfo);
 }
Example #29
0
 public ConSymbolInfo(IdToken idToken, Expr e)
     : base(idToken)
 {
     this.e = e;
 }
Example #30
0
 public UnaryExpr(SimpleToken token, int opcode, Expr operand)
     : base(token)
 {
     this.opcode = opcode;
     this.operand = operand;
 }