2014-02-17 12:53:57 -08:00
|
|
|
#include "tree_sitter/compiler.h"
|
2014-03-09 21:37:21 -07:00
|
|
|
#include "compiler/prepare_grammar/prepare_grammar.h"
|
|
|
|
|
#include "compiler/build_tables/build_tables.h"
|
|
|
|
|
#include "compiler/generate_code/c_code.h"
|
|
|
|
|
#include "compiler/prepared_grammar.h"
|
2014-01-11 15:14:17 -08:00
|
|
|
|
|
|
|
|
namespace tree_sitter {
|
2014-01-23 13:44:49 -08:00
|
|
|
std::string compile(const Grammar &grammar, std::string name) {
|
2014-03-02 15:07:43 -08:00
|
|
|
auto grammars = prepare_grammar::prepare_grammar(grammar);
|
|
|
|
|
auto tables = build_tables::build_tables(grammars.first, grammars.second);
|
2014-01-25 20:44:02 -08:00
|
|
|
return generate_code::c_code(name, tables.first, tables.second);
|
2014-01-11 15:14:17 -08:00
|
|
|
}
|
|
|
|
|
}
|