private ThreeAddressValueType GenVariable(LogicExprNode expr) { if (expr is BooleanNode) { return(new ThreeAddressLogicValue((expr as BooleanNode).Val)); } if (expr is LogicIdNode) { return(new ThreeAddressStringValue((expr as LogicIdNode).Name.Name)); } if (expr is LogicOpNode) { LogicOpNode op = expr as LogicOpNode; string res = GenTempVariable(); ThreeAddressValueType arg1 = GenVariable(op.Left); ThreeAddressValueType arg2 = GenVariable(op.Right); ThreeOperator p = ThreeCode.ParseOperator(op.Operation); AddCode(new ThreeCode(res, p, arg1, arg2)); return(new ThreeAddressStringValue(res)); } if (expr is LogicNotNode) { LogicNotNode lnot = expr as LogicNotNode; string res = GenTempVariable(); ThreeAddressValueType arg1 = GenVariable(lnot.LogExpr); AddCode(new ThreeCode(res, ThreeOperator.Logic_not, arg1)); return(new ThreeAddressStringValue(res)); } throw new Exception("UNKNOW VALUE. Send autors of ThreeAddressCode"); }
public override string GenCode() { var tmp2 = new EqualNode(left, right); tmp2.linenumber = linenumber; Node tmp = new LogicNotNode(tmp2); tmp.linenumber = linenumber; tmp.GenCode(); return(null); }
public override void VisitLogicNotNode(LogicNotNode lnot) { if (lnot == null) { return; } Node parent = st.Pop(); st.Push(parent); lnot.Parent = parent; st.Push(lnot); base.VisitLogicNotNode(lnot); st.Pop(); }
public override void VisitLogicNotNode(LogicNotNode v) { Text += "!"; v.LogExpr.Visit(this); }
public override void VisitLogicNotNode(LogicNotNode lnot) { lnot.LogExpr.Visit(this); }
public virtual void VisitLogicNotNode(LogicNotNode lnot) { }
public override void VisitLogicNotNode(LogicNotNode lnot) { ++Current; base.VisitLogicNotNode(lnot); }