diva.sketch.parser2d
Class Grammar2D

java.lang.Object
  extended by diva.sketch.parser2d.Grammar2D

public class Grammar2D
extends Object

A grammar is a collection of rules that implement productions and a collection of tokens that are expected from the low-level recognizer in order for these rules to make sense.

Version:
$Revision: 1.4 $
Author:
Michael Shilman (michaels@eecs.berkeley.edu)

Constructor Summary
Grammar2D(Rule[] rules, Type[] tokenTypes)
          Construct a grammar using the given set of rules and token types.
 
Method Summary
 Rule[] getRules()
          Return the set of rules that comprises this grammar.
 Type[] getTokenTypes()
          Return the set of token types that the grammar expects from the low-level recognizer in order to function properly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Grammar2D

public Grammar2D(Rule[] rules,
                 Type[] tokenTypes)
Construct a grammar using the given set of rules and token types. The rules define the body of the grammar, and the token types define its inputs from the low-level recognizer. The types used in the right-hand side (RHS) of each rule are expected to be defined in the LHS of other rules, or in the token types. This invariant is checked by the constructor and an illegal argument exception is thrown if this fails.

Method Detail

getRules

public Rule[] getRules()
Return the set of rules that comprises this grammar. Rules are in no particular order.


getTokenTypes

public Type[] getTokenTypes()
Return the set of token types that the grammar expects from the low-level recognizer in order to function properly.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.