Class GrammarFileReader
This class generates list of Context Free or Context Sensitive Rules from a text file. see CFGExample.txt and LIGExample.txt for example grammars.
Inherited Members
Namespace: EarleyParser
Assembly: EarleyParser.dll
Syntax
public class GrammarFileReader
Methods
| Edit this page View SourceCreateRule(string)
Creates a grammar rule from a string representation.
Declaration
public static Rule CreateRule(string s)
Parameters
| Type | Name | Description |
|---|---|---|
| string | s | The string representation of the rule. |
Returns
| Type | Description |
|---|---|
| Rule | A new Rule object. |
ReadRules(string[])
Reads grammar rules from an array of strings.
Declaration
public static List<Rule> ReadRules(string[] input)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | input | Array of strings containing grammar rules. |
Returns
| Type | Description |
|---|---|
| List<Rule> | A list of parsed grammar rules. |
ReadRulesFromFile(string, bool)
Reads grammar rules from a file.
Declaration
public static List<Rule> ReadRulesFromFile(string filename, bool isTest = false)
Parameters
| Type | Name | Description |
|---|---|---|
| string | filename | The path to the grammar file. |
| bool | isTest | If true, treats the file as a test grammar file. |
Returns
| Type | Description |
|---|---|
| List<Rule> | A list of parsed grammar rules. |