Example #1
0
        public LRParser(ILexer lexer, IGrammar grammar) : base(lexer, grammar)
        {
            var scriptLoader = new GenericScriptLoader();

            if (scriptLoader.Assembly == null)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Errors on scripts, can't continue...");
                Console.ResetColor();
                _error = true;
            }
            else
            {
                _semanticAnalyzer = scriptLoader.GetSemanticAnalyzer();
                _translator       = scriptLoader.GetTranslator();

                _parsingTable = new ParsingTable(grammar);
            }

            if (DEBUG_TABLE)
            {
                //_parsingTable.PrintTable();
                _parsingTable.SaveTable();
            }
        }
Example #2
0
 public Compiler(IFileReader reader,
                 ISourceSanitizer sanitizer,
                 ILexer lexer,
                 IParser parser,
                 ISemanticAnalyzer semanticValidator,
                 ITranspiler transpiler,
                 IFileWriter writer)
 {
     _reader            = reader;
     _sanitizer         = sanitizer;
     _lexer             = lexer;
     _parser            = parser;
     _semanticValidator = semanticValidator;
     _transpiler        = transpiler;
     _writer            = writer;
 }
 public SemanticAnalysisTest()
 {
     this.parser      = TestHelpers.getParser(TestHelpers.sampleProgram);
     this.analyzer    = new MiniPLSemanticAnalyzer();
     this.symbolTable = new SymbolTable();
 }