|
Mercury library
1.0
Translation of CFG grammars into an object model (Bachelor's thesis).
|
Class that creates grammars. More...
Inherited by Mercury.Syntax.ExtendedGrammarBuilder.
Public Member Functions | |
| GrammarBuilder () | |
| Default constructor. Uses Root and Epsilon symbols that are specified in the configuration. More... | |
| GrammarBuilder (Symbol root, Symbol epsilon) | |
| Creates a GrammarBuilder with custom Root and Epsilon symbols. More... | |
| GrammarBuilder | AddSymbol (Symbol newSymbol) |
| Adds a new symbol to the grammar. The destination set is determined by the symbol type. Epsilon or symbols that already are in the grammar are ignored. More... | |
| virtual GrammarBuilder | AddRule (Rule rule) |
| Adds a new rule to the grammar. If the rule contains symbols that are not in the grammar, they will be added. Rules that are already in the grammar will be ignored. More... | |
| GrammarBuilder | AddRules (IEnumerable< Rule > rules) |
| Adds the collection of rules to the builder. More... | |
| GrammarBuilder | Include (GrammarBuilder other) |
| Includes the other builder. More... | |
| Grammar | GetGrammar () |
| |
Protected Attributes | |
| HashSet< Symbol > | nonterminals = new HashSet<Symbol>() |
| HashSet< Symbol > | terminals = new HashSet<Symbol>() |
| HashSet< Rule > | rules = new HashSet<Rule>() |
Properties | |
| Symbol | Root [get, set] |
| Root symbol. More... | |
| Symbol | Epsilon [get, set] |
| Epsilon symbol. More... | |
Class that creates grammars.
Definition at line 13 of file GrammarBuilder.cs.
| Mercury.Syntax.GrammarBuilder.GrammarBuilder | ( | ) |
Default constructor. Uses Root and Epsilon symbols that are specified in the configuration.
Definition at line 27 of file GrammarBuilder.cs.
Creates a GrammarBuilder with custom Root and Epsilon symbols.
| root | A root symbol, must be a nonterminal. |
| epsilon | Epsilon symbol. |
Definition at line 36 of file GrammarBuilder.cs.
|
virtual |
Adds a new rule to the grammar. If the rule contains symbols that are not in the grammar, they will be added. Rules that are already in the grammar will be ignored.
| rule | The rule to be added |
Definition at line 93 of file GrammarBuilder.cs.
| GrammarBuilder Mercury.Syntax.GrammarBuilder.AddRules | ( | IEnumerable< Rule > | rules | ) |
Adds the collection of rules to the builder.
| rules | The rules. |
Definition at line 111 of file GrammarBuilder.cs.
| GrammarBuilder Mercury.Syntax.GrammarBuilder.AddSymbol | ( | Symbol | newSymbol | ) |
Adds a new symbol to the grammar. The destination set is determined by the symbol type. Epsilon or symbols that already are in the grammar are ignored.
| newSymbol | The new symbol. |
Definition at line 67 of file GrammarBuilder.cs.
| Grammar Mercury.Syntax.GrammarBuilder.GetGrammar | ( | ) |
Definition at line 121 of file GrammarBuilder.cs.
| GrammarBuilder Mercury.Syntax.GrammarBuilder.Include | ( | GrammarBuilder | other | ) |
Includes the other builder.
| other | The other builder. |
Definition at line 117 of file GrammarBuilder.cs.
Definition at line 17 of file GrammarBuilder.cs.
Definition at line 19 of file GrammarBuilder.cs.
Definition at line 18 of file GrammarBuilder.cs.
|
getset |
Epsilon symbol.
Definition at line 56 of file GrammarBuilder.cs.
|
getset |
Root symbol.
Definition at line 53 of file GrammarBuilder.cs.
1.8.7