private Continuation(Statistics statistics, IStack<LexicalEnvironment> envs, IStack<Task> tasks, IStack<Datum> results, ErrorHandler errorHandler)
 {
     this.statistics = statistics;
     this.envs = envs;
     this.tasks = tasks;
     this.results = results;
     this.errorHandler = errorHandler;
 }
Beispiel #2
0
 public Datum Evaluate(Statistics statistics, LexicalEnvironment env, Datum datum)
 {
     env.Statistics = statistics;
     var c = Continuation.Create(statistics)
         .PushTask(null)
         .PushResult(null)
         .Evaluate(env, datum);
     return Evaluate(c);
 }
Beispiel #3
0
 static void Main(string[] args)
 {
     try
     {
         var env = StandardEnvironment.Create();
         env.Define("args", DatumHelpers.atomList(args));
         var statistics = new Statistics();
         env = statistics.AddTo(env);
         ResourceLoader.ExecuteResource(statistics, Assembly.GetExecutingAssembly(), env, "Lisp.REPL.lisp");
     }
     catch (Exception ex)
     {
         Console.Error.WriteLine("ERROR:\n{0}\n{1}\n", ex, ex.StackTrace);
     }
 }
 private LexicalEnvironment(LexicalEnvironment parent, IStack<Binding> bindings)
 {
     this.statistics = parent == null ? null : parent.statistics;
     this.parent = parent;
     this.bindings = bindings;
 }
 /**
  * Used for bootstrapping various .lisp files into the environment.
  */
 public static void ExecuteResource(Statistics statistics, Assembly assembly, LexicalEnvironment env, string resourceFile)
 {
     var evaluator = new Evaluator();
     foreach (var d in ReadDatums(assembly, resourceFile))
         evaluator.Evaluate(statistics, env, d);
 }
Beispiel #6
0
 public Statistics Delta(Statistics prev)
 {
     return new Statistics {Steps = Steps - prev.Steps, Expansions = Expansions - prev.Expansions, Lookups = Lookups - prev.Lookups};
 }
Beispiel #7
0
 public Statistics(Statistics s)
 {
     this.Steps = s.Steps;
     this.Expansions = s.Expansions;
     this.Lookups = s.Lookups;
 }
 public static Continuation Create(Statistics s)
 {
     return new Continuation(s, Stack<LexicalEnvironment>.Empty.Push(null), Stack<Task>.Empty, Stack<Datum>.Empty, Unhandled);
 }
 private LexicalEnvironment(LexicalEnvironment parent, IStack <Binding> bindings)
 {
     this.statistics = parent == null ? null : parent.statistics;
     this.parent     = parent;
     this.bindings   = bindings;
 }