TODO : Make RE Grammar template independent. Difine Unified grammar format.
This commit is contained in:
parent
7ed6b1f33c
commit
38957e678b
4 changed files with 115 additions and 11 deletions
|
|
@ -12,15 +12,8 @@ SimpleParser::SimpleParser() {
|
|||
ContextFreeGrammar contextFreeGrammar;
|
||||
{
|
||||
// use existing CF grammar interface
|
||||
auto term = contextFreeGrammar.createTerminal();
|
||||
|
||||
auto nonTerm = contextFreeGrammar.createNonTerminal();
|
||||
auto nonTerm2 = contextFreeGrammar.createNonTerminal();
|
||||
|
||||
contextFreeGrammar.addRule(nonTerm, { term, nonTerm2 });
|
||||
contextFreeGrammar.addRule();
|
||||
|
||||
contextFreeGrammar.setStart(nonTerm);
|
||||
contextFreeGrammar.addRule("a", { ContextFreeGrammar::Arg("") });
|
||||
contextFreeGrammar.setStart("a");
|
||||
}
|
||||
|
||||
// Define Regular grammar
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue