Generate sentences from cf grammar. Fix list initialization from copy constructor

This commit is contained in:
IlushaShurupov 2023-08-11 16:04:02 +03:00
parent d888aeb2b4
commit 6fcfa075f8
4 changed files with 84 additions and 4 deletions

View file

@ -18,6 +18,14 @@ namespace tp {
List<Arg> args;
};
struct Sentence {
struct Term {
String id;
bool terminal;
};
List<Term> terms;
};
List<Rule> rules;
String startTerminal;
@ -41,7 +49,10 @@ namespace tp {
bool parse(CfGrammarParserState* context, const String& source);
bool compile();
bool isAmbiguous();
void generateSentences(List<Sentence>& out);
static void printSentence(Sentence& in);
private:
void optimize();
};
}