예제 #1
0
std::string PhasedExecution::execute(int argc, char* argv[])
{
    if (_contextManager != nullptr)
    {
        DeLOG("Destroying Old Context For Another Run.");
        delete _contextManager;
    }

    if (argc < 2)
    {
        perror("Not enough arguments, correct usage: ./repss input_file");

        return "";
    }

    _contextManager = new ContextManager();

    auto lexerContext = _contextManager->getContext<ContextType::AllowedTypes, ContextType::Lexer>();

    std::string inputFileName{argv[1]};
    runLexer(&lexerContext, inputFileName);  

    auto grammarContext = _contextManager->getContext<ContextType::AllowedTypes, ContextType::Grammar>();
    runGrammarAggregation(&grammarContext);

    delete _contextManager;
    _contextManager = nullptr;

    DeLOG("Finished PhasedExecution\n");

    std::string generatedOutput;
    return generatedOutput;
}
예제 #2
0
파일: lex.c 프로젝트: armarts/Compiler
int main(int argc, char **argv)
{
    init_io(&in, stdin, "r", argc > 1 ? argv[1] : "");
    init_io(&out, stdout, "w", argc > 2 ? argv[2] : "");

    runLexer();
    
    return 0;
}