예제 #1
0
 public LanguageRepl(bool shouldShowTree, bool shouldShowProgram, bool isMultiLine, bool shouldEvaluate) : base(isMultiLine)
 {
     showTree    = shouldShowTree;
     showProgram = shouldShowProgram;
     evaluate    = shouldEvaluate;
     environment = new BindingEnvironment(false);
 }
예제 #2
0
        public void Evaluate(BindingEnvironment env, Dictionary <VariableSymbol, object> variables)
        {
            var res = env.CurrentInterpretation.Evaluate(variables);

            if (res.Diagnostics.Any())
            {
                PrintDiagnostic(res.Diagnostics);
            }
            else if (evaluate && res.Value != null)
            {
                Console.WriteLine(res.Value, DEFAULT_COLOR);
            }
        }
예제 #3
0
        public static void Evaluate(BindingEnvironment env, Dictionary <VariableSymbol, object> variables)
        {
            var res = env.CurrentInterpretation.Evaluate(variables);

            if (res.Diagnostics.Any())
            {
                foreach (var diagnostic in res.Diagnostics)
                {
                    Console.WriteLine(diagnostic);
                }
            }
            else
            {
                Console.WriteLine(res.Value);
            }
        }
예제 #4
0
 public object Evaluate(BindingEnvironment environment)
 {
     return(this.value);
 }
예제 #5
0
 public void Execute(BindingEnvironment environment)
 {
     environment.SetValue(this.name, this.expression.Evaluate(environment));
 }
예제 #6
0
 public object Evaluate(BindingEnvironment environment)
 {
     return(environment.GetValue(this.name));
 }