Skip to content

Commit

Permalink
BUF-71 remove all terminal copying and tokenize in parser;
Browse files Browse the repository at this point in the history
  • Loading branch information
NateSeymour committed Nov 25, 2024
1 parent 1cca7b3 commit 4ec4c26
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 292 deletions.
5 changes: 1 addition & 4 deletions examples/calculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ bf::DefineTerminal<G, R"(\-)"> OP_SUB(bf::Left);
bf::DefineTerminal<G, R"(\()"> PAR_OPEN;
bf::DefineTerminal<G, R"(\))"> PAR_CLOSE;

bf::Terminal<G> terminals[] = { NUMBER, OP_EXP, OP_MUL, OP_DIV, OP_ADD, OP_SUB, PAR_OPEN, PAR_CLOSE };
bf::CTRETokenizer tokenizer(std::to_array(terminals));

/*
* Non-Terminals
*/
Expand Down Expand Up @@ -55,7 +52,7 @@ int main(int argc, char const **argv)
return 1;
}

auto calculator = *bf::SLRParser<G>::Build(tokenizer, statement);
auto calculator = *bf::SLRParser<G>::Build(statement);

auto result = calculator.Parse(argv[1]);
if(!result)
Expand Down
Loading

0 comments on commit 4ec4c26

Please sign in to comment.