Schemin.Interpret.Interpreter.Interpret C# (CSharp) Method

Interpret() public method

public Interpret ( List tokens ) : IScheminType
tokens List
return IScheminType
        public IScheminType Interpret(List<Token> tokens)
        {
            try
            {
                var parsed = this.parser.Parse(tokens, false);

                var expanded = (ScheminPair) this.macroExpander.ExpandAll(parsed);
                IScheminType returnType = this.evaluator.EvaluateInternal(expanded);

                return returnType;
            }
            catch (BadArgumentsException b)
            {
                this.evaluator.CurrentOutputPort.OutputStream.WriteLine("bad arguments: " + b.Message);
                return new ScheminPair();
            }
            catch (Exception e)
            {
                this.evaluator.CurrentOutputPort.OutputStream.WriteLine("error: " + e.Message);
                return new ScheminPair();
            }
        }

Same methods

Interpreter::Interpret ( string scheminCode ) : IScheminType

Usage Example

Beispiel #1
0
 static void InterpretFile(string filename)
 {
     Interpreter i = new Interpreter();
     string contents = File.ReadAllText(filename);
     Console.WriteLine(i.Interpret(contents));
 }
All Usage Examples Of Schemin.Interpret.Interpreter::Interpret