Example #1
0
 public EvaluationWidget()
 {
     var interpreter = new Interpreter(value => readEvalPrintLoopView.Print(value.ToString()));
     var scope = new Scope();
     var resolver = new Resolver(scope, (type, expression) => {
         if(type != typeof(void)) {
             expression(interpreter);
         }
     });
     var context = new CompilationContext();
     var driver = new Driver((indentation, syntax) => syntax(resolver), context);
     var scrolledWindow = new ScrolledWindow();
     readEvalPrintLoopView = new ReadEvalPrintLoopView(text => {
         var column = 0;
         foreach(var character in text) {
             driver.Tokenize(new Character(character, new Location(null, 0, column)));
             column++;
         }
         driver.Tokenize(new Character('\n', new Location(null, 0, column)));
     });
     scrolledWindow.Add(readEvalPrintLoopView);
     PackStart(scrolledWindow);
     ShowAll();
 }