This project is read-only.

Specifying a Grammar

Terminals

[Terminal(@"\d+")]
public class Number : Terminal
{
}
A terminal is a class that:
  • Inherits directly or indirectly from Terminal.
  • Has a public default constructor.
  • Is adorned with a TeriminalAttribute containing the regular expression that defines the terminal.

Nonterminals

public class BooleanOperator : Nonterminal
{
}
A nonterminal is a class that:
  • Inherits directly or indirectly from Nonterminal.
  • Has a public default constructor.

Rules

public class BooleanOperator : Nonterminal
{
    public static void Rule(BooleanOperator result, OperatorAddition op)
    {
      // Code
    }
}
A rule is a static method that:
  • Contains at least two parameters.
  • Specifies a nonterminal as its first parameter.
  • Specifies either terminals or nonterminals for all remaining parameters.

Last edited Oct 18, 2009 at 12:33 AM by rtodd, version 5

Comments

No comments yet.