diff --git a/alib2/src/grammar/ContextFree/GNF.h b/alib2/src/grammar/ContextFree/GNF.h index c336fed2a0e69aaaf6a3e65e98dccddad9deebf9..0ee796328c38d6177b583ffd45442866d0469df2 100644 --- a/alib2/src/grammar/ContextFree/GNF.h +++ b/alib2/src/grammar/ContextFree/GNF.h @@ -15,7 +15,7 @@ namespace grammar { /** - * Context free grammar in chomsky normal form. Type 2 in Chomsky hierarchy. Produces context free languages. + * Context free grammar in greibach normal form. Type 2 in Chomsky hierarchy. Produces context free languages. */ class GNF : public std::element<GNF, GrammarBase>, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>> rules; diff --git a/alib2/src/grammar/ContextFree/LG.h b/alib2/src/grammar/ContextFree/LG.h index 0394114760d32a3427d582753d1745b5e93d90cf..f957ec1a11bd4bd77b1b4f32aef584a1437de10f 100644 --- a/alib2/src/grammar/ContextFree/LG.h +++ b/alib2/src/grammar/ContextFree/LG.h @@ -15,7 +15,7 @@ namespace grammar { /** - * Context free grammar in chomsky normal form. Type 2 in Chomsky hierarchy. Produces context free languages. + * Linear grammar. Type 2 in Chomsky hierarchy. Produces context free languages. */ class LG : public std::element<LG, GrammarBase>, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>> rules; diff --git a/alib2/src/grammar/Regular/LeftLG.h b/alib2/src/grammar/Regular/LeftLG.h index 47a30c25172b791a8b7f9e8445459fa6ff53693c..807756dd64376946fb0fe0a0513b65a8a6c01415 100644 --- a/alib2/src/grammar/Regular/LeftLG.h +++ b/alib2/src/grammar/Regular/LeftLG.h @@ -15,7 +15,7 @@ namespace grammar { /** - * Context free grammar in chomsky normal form. Type 2 in Chomsky hierarchy. Produces context free languages. + * Left linear grammar in chomsky normal form. Type 3 in Chomsky hierarchy. Produces regular languages. */ class LeftLG : public std::element<LeftLG, GrammarBase>, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>> rules; diff --git a/alib2/src/grammar/Regular/LeftRG.h b/alib2/src/grammar/Regular/LeftRG.h index 1a1591d5ea1cd4e85c3c2b20d35f33f286029219..b5f180483c1e8a824f5d6ee2a30861632940cee2 100644 --- a/alib2/src/grammar/Regular/LeftRG.h +++ b/alib2/src/grammar/Regular/LeftRG.h @@ -15,7 +15,7 @@ namespace grammar { /** - * Context free grammar in chomsky normal form. Type 2 in Chomsky hierarchy. Produces context free languages. + * Left regular grammar in chomsky normal form. Type 3 in Chomsky hierarchy. Produces regular languages. */ class LeftRG : public std::element<LeftRG, GrammarBase>, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>> rules; diff --git a/alib2/src/grammar/Regular/RightLG.h b/alib2/src/grammar/Regular/RightLG.h index 368403137830baa9fe764cfe205886f61282663d..e4ed7f764ba6a4c97618e76c23aaa3dc73498049 100644 --- a/alib2/src/grammar/Regular/RightLG.h +++ b/alib2/src/grammar/Regular/RightLG.h @@ -15,7 +15,7 @@ namespace grammar { /** - * Context free grammar in chomsky normal form. Type 2 in Chomsky hierarchy. Produces context free languages. + * Right linear grammar in chomsky normal form. Type 3 in Chomsky hierarchy. Produces regular languages. */ class RightLG : public std::element<RightLG, GrammarBase>, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>> rules; diff --git a/alib2/src/grammar/Regular/RightRG.h b/alib2/src/grammar/Regular/RightRG.h index 73648b49fb4402f71bf1b5c2a1e8c116642bac70..c4f6bb542266286b4e1245e37b60fdfb069d502c 100644 --- a/alib2/src/grammar/Regular/RightRG.h +++ b/alib2/src/grammar/Regular/RightRG.h @@ -15,7 +15,12 @@ namespace grammar { /** - * Context free grammar in chomsky normal form. Type 2 in Chomsky hierarchy. Produces context free languages. + * Right regular grammar in chomsky normal form. Type 2 in Chomsky hierarchy. Produces regular languages. + * G = (N, T, P, S) + * N = nonempty finite set of nonterminal symbols + * T = finite set of terminal symbols - having this empty wont allow much though + * P = set of production rules of the form A -> aB or A -> a (where A, B \in N and a \in T) or S -> \varepsilon (when S is not on the right hand side of any rule) + * S = initial nonterminal symbol */ class RightRG : public std::element<RightRG, GrammarBase>, public TerminalNonterminalAlphabetInitialSymbol { std::map<alphabet::Symbol, std::set<std::vector<alphabet::Symbol>>> rules;