Beispiel #1
0
        public void GetDefaultSettings()
        {
            string executingPath  = Path.GetDirectoryName(System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);
            string defaultSetting = Path.Join(executingPath, "default.lig");

            if (File.Exists(defaultSetting))
            {
                string text   = File.ReadAllText(defaultSetting);
                Parser parser = new Parser();
                parser.Load(text, 0);
                ProgramAST p = parser.Parse();
                p.Statements.Statements.RemoveAll(ast => !(ast is ConfAST));
                Interpreter interpreter = Interpreter.GetInstance(defaultSetting);
                interpreter.Interpret(p);
            }
            ApplySetting();
        }
Beispiel #2
0
 private object Visit(ProgramAST programAST)
 {
     currentScope             = new ScopeSymbolTable(programAST.Name, 0);
     modules[CurrentFileName] = currentScope;
     return(Visit(programAST.Statements));
 }
Beispiel #3
0
 public void Interpret(ProgramAST programAST)
 {
     logger.Info($"Interpreter started at {CurrentFileName}");
     Visit(programAST);
 }