2015-12-08 04:51:55 +08:00
|
|
|
#pragma once
|
2015-10-19 01:44:00 +08:00
|
|
|
|
2016-02-03 07:18:20 +08:00
|
|
|
#include "tokenizer/cypher_lexer.hpp"
|
2015-10-19 01:44:00 +08:00
|
|
|
#include "parser.hpp"
|
|
|
|
|
|
|
|
namespace cypher
|
|
|
|
{
|
|
|
|
|
|
|
|
class Compiler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Compiler() = default;
|
|
|
|
|
2015-10-30 08:24:01 +08:00
|
|
|
ast::Ast syntax_tree(const std::string& input)
|
2015-10-19 01:44:00 +08:00
|
|
|
{
|
|
|
|
auto parser = cypher::Parser();
|
|
|
|
auto tokenizer = lexer.tokenize(input);
|
|
|
|
auto tree = parser.parse(tokenizer);
|
2016-02-06 20:45:45 +08:00
|
|
|
return tree;
|
2015-10-19 01:44:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
CypherLexer lexer;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|