public void Interpret(Context context) { Console.WriteLine($"Nonterminal for {context.Name}."); Expression1.Interpret(context); Expression2.Interpret(context); }
public int Interpret(Context context) { int newScore = 0; int a = Expression1.Interpret(context); int b = Expression2.Interpret(context); return(newScore = a + b); }
static void Main() { Context context = new Context("Context"); AbstractExpression exp = null; exp = new Expression1(); exp.Interpret(context); exp = new Expression2(); exp.Interpret(context); Console.ReadKey(); }
public override void Interpret(Context context) { Console.WriteLine("Nonterminal for {0}.", context.Name); Expression1.Interpret(context); Expression2.Interpret(context); }
/// <summary> /// Interprets a string and evalutes the AND of both composite expressions. /// </summary> /// <param name="str">A string to interpret.</param> /// <returns><c>bool</c> - True if expression 1 AND expression 2 else False.</returns> public override bool Interpret(string str) { return(Expression1.Interpret(str) && Expression2.Interpret(str)); }