Esempio n. 1
0
 public LanguageRepl(bool shouldShowTree, bool shouldShowProgram, bool isMultiLine, bool shouldEvaluate) : base(isMultiLine)
 {
     showTree    = shouldShowTree;
     showProgram = shouldShowProgram;
     evaluate    = shouldEvaluate;
     environment = new BindingEnvironment(false);
 }
Esempio n. 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);
            }
        }
Esempio n. 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);
            }
        }
 public object Evaluate(BindingEnvironment environment)
 {
     return(this.value);
 }
Esempio n. 5
0
 public void Execute(BindingEnvironment environment)
 {
     environment.SetValue(this.name, this.expression.Evaluate(environment));
 }
Esempio n. 6
0
 public object Evaluate(BindingEnvironment environment)
 {
     return(environment.GetValue(this.name));
 }