Example #1
0
        public ILang(string file, string flags)
        {
            flags = "-x -i";
            bool xref = flags.Contains("-x");
            bool inter = flags.Contains("-i");
            try
            {
                using (_source = new Source(new StreamReader(file)))
                {
                    Source.Message += new EventHandler<MessageEventArgs>(MessageEmitted);
                    Parser.Message += new EventHandler<MessageEventArgs>(MessageEmitted);

                    _parser = new ILangParserFactory().GetParser(_source);
                    _parser.Parse();

                    _iCode = _parser.ICode;
                    _symTab = _parser.SymbolicTable;

                    _executor = new Executor();
                    _executor.Process(_iCode, _symTab);
                }
                if (xref)
                {
                    CrossReferencer.Print(ILangParser.Stack);
                }
                if (inter)
                {
                    Console.WriteLine();
                    new SyntaxTreePrinter(Console.Out).Print(_iCode);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("******* Internal error. *******");
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }
        }
Example #2
0
 public ILangScanner(Source source)
     : base(source)
 {
 }
Example #3
0
 public Scanner(Source source)
 {
     Source = source;
 }