Skip to content
Snippets Groups Projects
Commit d9afbb54 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

expose normalize to LL1

parent c5115593
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,7 @@
#include "grammar/convert/ToGrammarRightRG.h"
#include "grammar/simplify/ToCNF.h"
#include "grammar/simplify/ToGNF.h"
#include "grammar/parsing/DeterministicLL1Grammar.h"
 
int main(int argc, char** argv) {
 
......@@ -26,7 +27,7 @@ int main(int argc, char** argv) {
TCLAP::ValueArg<std::string> input( "i", "input", "Input to normalize", false, "-", "file");
cmd.add( input );
 
std::vector<std::string> forms {"leftRG", "rightRG", "singleInitialState", "CNF", "GNF" };
std::vector<std::string> forms {"leftRG", "rightRG", "singleInitialState", "CNF", "GNF", "LL1" };
TCLAP::ValuesConstraint<std::string> formVals( forms );
 
TCLAP::ValueArg<std::string> form( "f", "form", "Convert to different form", false, "", &formVals);
......@@ -166,6 +167,18 @@ int main(int argc, char** argv) {
std::chrono::measurements::end();
std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY);
 
alib::XmlDataFactory::toStdout(res);
} else if(form.getValue() == "LL1") {
grammar::Grammar grammar = alib::XmlDataFactory::fromTokens<grammar::Grammar>( tokens );
std::chrono::measurements::end();
std::chrono::measurements::start("Algorithm", std::chrono::measurements::Type::MAIN);
grammar::Grammar res = grammar::parsing::DeterministicLL1Grammar::convert(grammar);
std::chrono::measurements::end();
std::chrono::measurements::start("Output write", std::chrono::measurements::Type::AUXILARY);
alib::XmlDataFactory::toStdout(res);
} else {
throw exception::AlibException("Invalid normalize command");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment