// Parse and translate a Boolean factor with not private void NotFactor() { if (Cradle.Look == '!') { Cradle.Match('!'); BoolFactor(); Cradle.EmitLn("EOR #-1,D0"); } else BoolFactor(); }
// Parse and translate an identity private void Ident() { char name = Cradle.GetName(); if (Cradle.Look == '(') { Cradle.Match('('); Expression(); Cradle.Match(')'); Cradle.EmitLn("BSR " + name); } else Cradle.EmitLn("MOVE " + name + "(PC),D0"); }
// Parse and translate a Boolean expression private void BoolExpression() { BoolTerm(); while (IsOrop(Cradle.Look)) { Cradle.EmitLn("MOVE D0,-(SP)"); switch (Cradle.Look) { case '|': BoolOr(); break; case '~': BoolXor(); break; } } }
public Compiler() { do { Scan(); switch (Token) { case SymType.Ident: Cradle.Emit("Ident "); break; case SymType.Number: Cradle.Emit("Number "); break; case SymType.Operator: Cradle.Emit("Operator "); break; default: Cradle.Emit("Keyword "); break; } Cradle.EmitLn(Value); }while (Token != SymType.EndSym); }
public Compiler() { do { Scan(); switch (Token) { case 'x': Cradle.Emit("Ident "); break; case '#': Cradle.Emit("Number "); break; case 'i': Cradle.Emit("Keyword "); break; case 'e': Cradle.Emit("Keyword "); break; case 'l': Cradle.Emit("Keyword "); break; default: Cradle.Emit("Operator "); break; } Cradle.EmitLn(Value); }while (Value != "END"); }