com.inxar.syntacs.translator.test
Class EtfGrammar

java.lang.Object
  |
  +--com.inxar.syntacs.translator.test.EtfGrammar
All Implemented Interfaces:
LRTranslatorGrammar, Serializable, TranslatorGrammar

public class EtfGrammar
extends Object
implements LRTranslatorGrammar

Automatically generated by Syntacs Translation Toolkit on Fri Jul 06 12:05:01 PDT 2001

# GRAMMAR
  DECLARATION
 this is etf version 0.0.1;
 
 # PROPERTY DEFINITIONS
 property viz-namespace = "etf";
 property compile-dpa-debug = "true";
 property viz-dpa-size = "12,12";
 property viz-syntactic = "true";
 property author-email = "pcj@inxar.org";
 property author = "Paul Cody Johnston";
 property compile-pickle = "false";
 property viz-sourcepath = "./grammar";
 property viz-lexical = "true";
 property compile-namespace = "com.inxar.syntacs.translator.test";
 property compile-dpa-constructor-method = "LALR1";
 property compile-sourcepath = "./src";
 
 # TERMINAL DECLARATIONS
 terminal PL;
 terminal ST;
 terminal OP;
 terminal CP;
 terminal ID;
 
 # TERMINAL DEFINITIONS
 PL matches "\+";
 ST matches "\*";
 OP matches "\(";
 CP matches "\)";
 ID matches " [_a-zA-Z] [_a-zA-Z0-9]* ";
 
 # NONTERMINAL DECLARATIONS
 nonterminal Goal;
 nonterminal E;
 nonterminal T;
 nonterminal F;
 
 # NONTERMINAL DEFINITIONS
 reduce Goal when E;
 reduce E when E PL T;
 reduce E when T;
 reduce T when T ST F;
 reduce T when F;
 reduce F when OP E CP;
 reduce F when ID;
 
 accept when Goal;
 
 # CONTEXT DECLARATIONS
 context default;
 
 # CONTEXT DEFINITIONS
 default includes PL, ST, OP, CP, ID;
 
 start in context default;
 
 

See Also:
Serialized Form

Field Summary
static int C_default
          Constant ID for default
static int N_E
          NonTerminal ID for E
static int N_F
          NonTerminal ID for F
static int N_Goal
          NonTerminal ID for Goal
static int N_T
          NonTerminal ID for T
static int P_E__E_PL_T
          Production ID for E__E_PL_T
static int P_E__T
          Production ID for E__T
static int P_F__ID
          Production ID for F__ID
static int P_F__OP_E_CP
          Production ID for F__OP_E_CP
static int P_Goal__E
          Production ID for Goal__E
static int P_T__F
          Production ID for T__F
static int P_T__T_ST_F
          Production ID for T__T_ST_F
static int T_CP
          Terminal ID for CP
static int T_ID
          Terminal ID for ID
static int T_OP
          Terminal ID for OP
static int T_PL
          Terminal ID for PL
static int T_ST
          Terminal ID for ST
 
Fields inherited from interface org.inxar.syntacs.translator.lr.LRTranslatorGrammar
ACTION_PEEK, ACTION_PEEL, ACTION_POP, ACTION_POUNCE, ACTION_PUSH, UNDEFINED, UNDEFINED_CONTEXT, UNDEFINED_NONTERMINAL, UNDEFINED_PRODUCTION, UNDEFINED_SYMBOL, UNDEFINED_TERMINAL
 
Constructor Summary
EtfGrammar()
           
 
Method Summary
 String getContext(int ID)
          Returns the name of the context having the given ID or null if no such ID is known.
 int getContextAction(int cID, int tID)
          Returns the action defined for the given grammar symbol in the given context as one of the ACTION_XXX constants in this interface.
 int getContextRegister(int cID, int tID)
          Returns an integer stored at the value of the given contextID and symbolID.
 IntArray getContexts()
          Returns the list of context ID numbers as an IntArray.
 IntArray getContextTerminals(int ID)
          Returns a list of terminals defined within the context having the given ID or null if no such ID is known.
 int getGoalNonTerminal()
          Returns the ID of the goal symbol (a nonterminal) or UNDEFINED_NONTERMINAL is no such goal symbol has been set.
 String getName()
          Returns the name of the Translator.
 String getNonTerminal(int ID)
          Returns the name of the nonterminal having the given ID or null if no such ID is known.
 IntArray getNonTerminals()
          Returns the list of nonterminal ID numbers as an IntArray.
 String getProduction(int ID)
          Returns the name of the production having the given ID or null if no such ID is known.
 int getProductionLength(int ID)
          Returns the length of the list of grammar symbols of the right-hand-side of the production having the given ID or UNDEFINED_PRODUCTION if no such ID is known.
 int getProductionNonTerminal(int ID)
          Returns the ID of the nonterminal obtained by reduction of the given productionID or UNDEFINED_PRODUCTION if no such production is known.
 IntArray getProductions()
          Returns the list of production ID numbers as an IntArray.
 IntArray getProductionSymbols(int ID)
          Returns the list of grammar symbols of the right-hand-side of the production having the given ID as an IntArray or null if no such ID is known.
 int getStartContext()
          Returns the ID of the initial context.
 String getTerminal(int ID)
          Returns the name of the terminal having the given ID or null if no such ID is known.
 IntArray getTerminalContexts(int ID)
          Returns a list of contexts in which this terminal is defined.
 Object getTerminalRegexp(int ID)
          Returns the regular expression String for the terminal having the given ID or null if no such ID is known.
 IntArray getTerminals()
          Returns the list of terminal ID numbers as an IntArray.
 String getVersion()
          Returns the version number given to this grammar.
 Translator newTranslator()
          Returns a new Translator for this TranslatorGrammar having some default set of properties.
 Translator newTranslator(Properties p)
          Returns a new Translator for this TranslatorGrammar using the given Properties.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

C_default

public static final int C_default
Constant ID for default

T_PL

public static final int T_PL
Terminal ID for PL

T_ST

public static final int T_ST
Terminal ID for ST

T_OP

public static final int T_OP
Terminal ID for OP

T_CP

public static final int T_CP
Terminal ID for CP

T_ID

public static final int T_ID
Terminal ID for ID

N_Goal

public static final int N_Goal
NonTerminal ID for Goal

N_E

public static final int N_E
NonTerminal ID for E

N_T

public static final int N_T
NonTerminal ID for T

N_F

public static final int N_F
NonTerminal ID for F

P_Goal__E

public static final int P_Goal__E
Production ID for Goal__E

P_E__E_PL_T

public static final int P_E__E_PL_T
Production ID for E__E_PL_T

P_E__T

public static final int P_E__T
Production ID for E__T

P_T__T_ST_F

public static final int P_T__T_ST_F
Production ID for T__T_ST_F

P_T__F

public static final int P_T__F
Production ID for T__F

P_F__OP_E_CP

public static final int P_F__OP_E_CP
Production ID for F__OP_E_CP

P_F__ID

public static final int P_F__ID
Production ID for F__ID
Constructor Detail

EtfGrammar

public EtfGrammar()
Method Detail

getContext

public String getContext(int ID)
Description copied from interface: LRTranslatorGrammar
Returns the name of the context having the given ID or null if no such ID is known.
Specified by:
getContext in interface LRTranslatorGrammar

getContextAction

public int getContextAction(int cID,
                            int tID)
Description copied from interface: LRTranslatorGrammar
Returns the action defined for the given grammar symbol in the given context as one of the ACTION_XXX constants in this interface. If the contextID or symbolID is not known, UNDEFINED_CONTEXT or UNDEFINED_SYMBOL will be returned. Note: If UNDEFINED_SYMBOL is returned the ID may still be a valid terminal or nonterminal, but it not a member of the given context.
Specified by:
getContextAction in interface LRTranslatorGrammar

getContextRegister

public int getContextRegister(int cID,
                              int tID)
Description copied from interface: LRTranslatorGrammar
Returns an integer stored at the value of the given contextID and symbolID. This is used in conjunction with getContextAction(int, int) such that the second member in the tuple (action, register) is returned. If the contextID or symbolID is not known, UNDEFINED_CONTEXT or UNDEFINED_SYMBOL will be returned.
Specified by:
getContextRegister in interface LRTranslatorGrammar

getContextTerminals

public IntArray getContextTerminals(int ID)
Description copied from interface: LRTranslatorGrammar
Returns a list of terminals defined within the context having the given ID or null if no such ID is known.
Specified by:
getContextTerminals in interface LRTranslatorGrammar

getContexts

public IntArray getContexts()
Description copied from interface: LRTranslatorGrammar
Returns the list of context ID numbers as an IntArray.
Specified by:
getContexts in interface LRTranslatorGrammar

getGoalNonTerminal

public int getGoalNonTerminal()
Description copied from interface: LRTranslatorGrammar
Returns the ID of the goal symbol (a nonterminal) or UNDEFINED_NONTERMINAL is no such goal symbol has been set.
Specified by:
getGoalNonTerminal in interface LRTranslatorGrammar

getName

public String getName()
Description copied from interface: TranslatorGrammar
Returns the name of the Translator.
Specified by:
getName in interface TranslatorGrammar

getNonTerminal

public String getNonTerminal(int ID)
Description copied from interface: LRTranslatorGrammar
Returns the name of the nonterminal having the given ID or null if no such ID is known.
Specified by:
getNonTerminal in interface LRTranslatorGrammar

getNonTerminals

public IntArray getNonTerminals()
Description copied from interface: LRTranslatorGrammar
Returns the list of nonterminal ID numbers as an IntArray.
Specified by:
getNonTerminals in interface LRTranslatorGrammar

getProduction

public String getProduction(int ID)
Description copied from interface: LRTranslatorGrammar
Returns the name of the production having the given ID or null if no such ID is known. The String has the format "nonterminal: sym1 sym2 sym3" such that the nonterminal name is the first part of the string, followed by a colon, followed by a space delimited list of symbols.
Specified by:
getProduction in interface LRTranslatorGrammar

getProductionLength

public int getProductionLength(int ID)
Description copied from interface: LRTranslatorGrammar
Returns the length of the list of grammar symbols of the right-hand-side of the production having the given ID or UNDEFINED_PRODUCTION if no such ID is known.
Specified by:
getProductionLength in interface LRTranslatorGrammar

getProductionNonTerminal

public int getProductionNonTerminal(int ID)
Description copied from interface: LRTranslatorGrammar
Returns the ID of the nonterminal obtained by reduction of the given productionID or UNDEFINED_PRODUCTION if no such production is known.
Specified by:
getProductionNonTerminal in interface LRTranslatorGrammar

getProductionSymbols

public IntArray getProductionSymbols(int ID)
Description copied from interface: LRTranslatorGrammar
Returns the list of grammar symbols of the right-hand-side of the production having the given ID as an IntArray or null if no such ID is known.
Specified by:
getProductionSymbols in interface LRTranslatorGrammar

getProductions

public IntArray getProductions()
Description copied from interface: LRTranslatorGrammar
Returns the list of production ID numbers as an IntArray.
Specified by:
getProductions in interface LRTranslatorGrammar

getStartContext

public int getStartContext()
Description copied from interface: LRTranslatorGrammar
Returns the ID of the initial context.
Specified by:
getStartContext in interface LRTranslatorGrammar

getTerminal

public String getTerminal(int ID)
Description copied from interface: LRTranslatorGrammar
Returns the name of the terminal having the given ID or null if no such ID is known.
Specified by:
getTerminal in interface LRTranslatorGrammar

getTerminalContexts

public IntArray getTerminalContexts(int ID)
Description copied from interface: LRTranslatorGrammar
Returns a list of contexts in which this terminal is defined.
Specified by:
getTerminalContexts in interface LRTranslatorGrammar

getTerminalRegexp

public Object getTerminalRegexp(int ID)
Description copied from interface: LRTranslatorGrammar
Returns the regular expression String for the terminal having the given ID or null if no such ID is known. If the terminal ID is valid but no definition has been provided for that terminal, the empty string "" will be returned.
Specified by:
getTerminalRegexp in interface LRTranslatorGrammar

getTerminals

public IntArray getTerminals()
Description copied from interface: LRTranslatorGrammar
Returns the list of terminal ID numbers as an IntArray.
Specified by:
getTerminals in interface LRTranslatorGrammar

getVersion

public String getVersion()
Description copied from interface: TranslatorGrammar
Returns the version number given to this grammar.
Specified by:
getVersion in interface TranslatorGrammar

newTranslator

public Translator newTranslator()
Description copied from interface: TranslatorGrammar
Returns a new Translator for this TranslatorGrammar having some default set of properties.
Specified by:
newTranslator in interface TranslatorGrammar

newTranslator

public Translator newTranslator(Properties p)
Description copied from interface: TranslatorGrammar
Returns a new Translator for this TranslatorGrammar using the given Properties. The names and values of the elements in the Properties may be used to modify or communicate with the internals of the Translator instance (such as turning on debugging). The specifics reagarding the names and values of the properties are specific to the translator itself and need be documented elsewhere.
Specified by:
newTranslator in interface TranslatorGrammar