1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
using System;
using System.IO;
using antlr;
using antlr.collections;
/** A simple node to represent PLUS operation */
public class PLUSNode : BinaryOperatorAST {
public PLUSNode() {
}
public PLUSNode(Token tok) {
}
/** Compute value of subtree; this is heterogeneous part :) */
public override int Value() {
return Left().Value() + Right().Value();
}
public override string ToString() {
return " +";
}
public override void xmlSerializeRootOpen(TextWriter outWriter) {
outWriter.Write("<PLUS>");
}
public override void xmlSerializeRootClose(TextWriter outWriter) {
outWriter.Write("</PLUS>");
}
}
|