Beispiel #1
0
        public Interpreter(IScope globalScope, IInterpreterListener listener)
        {
            if (globalScope == null)
            {
                throw new ArgumentNullException(nameof(globalScope), "Global scope can't be null");
            }
            GlobalScope = globalScope;

            if (listener == null)
            {
                throw new ArgumentNullException(nameof(listener), "Listener can't be null");
            }
            Listener = listener;

            _parser = new KermitParser(null, globalScope)
            {
                TreeAdaptor = new KermitAdaptor()
            };
            //_parser.TraceDestination = Console.Error;

            _currentSpace = Globals;

            AddInternalNativeFunctions();
            AddNativeType("List", typeof(List <object>));
            AddNativeType(typeof(string));
            AddNativeType("Dictionary", typeof(Dictionary <object, object>));
        }
Beispiel #2
0
 // ReSharper disable MemberCanBePrivate.Global
 public Interpreter(IInterpreterListener listener) : this(new GlobalScope(), listener)
 {
     ((GlobalScope)GlobalScope).CommitScope();
 }