|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.inxar.syntacs.translator.test.SccGrammar
Automatically generated by Syntacs Translation Toolkit on Fri Jul 06 12:05:04 PDT 2001
# GRAMMAR DECLARATION this is scc version 0.0.1; # PROPERTY DEFINITIONS property viz-namespace = "scc"; property viz-syntactic = "true"; property author-email = "pcj@inxar.org"; property author = "Paul Cody Johnston"; 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 c; terminal d; # TERMINAL DEFINITIONS c matches "c"; d matches "d"; # NONTERMINAL DECLARATIONS nonterminal Goal; nonterminal S; nonterminal C; # NONTERMINAL DEFINITIONS reduce Goal when S; reduce S when C C; reduce C when c C; reduce C when d; accept when Goal; # CONTEXT DECLARATIONS context default; # CONTEXT DEFINITIONS default includes c, d; start in context default;
Field Summary | |
static int |
C_default
Constant ID for default |
static int |
N_C
NonTerminal ID for C |
static int |
N_Goal
NonTerminal ID for Goal |
static int |
N_S
NonTerminal ID for S |
static int |
P_C__c_C
Production ID for C__c_C |
static int |
P_C__d
Production ID for C__d |
static int |
P_Goal__S
Production ID for Goal__S |
static int |
P_S__C_C
Production ID for S__C_C |
static int |
T_c
Terminal ID for c |
static int |
T_d
Terminal ID for d |
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 | |
SccGrammar()
|
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 |
public static final int C_default
public static final int T_c
public static final int T_d
public static final int N_Goal
public static final int N_S
public static final int N_C
public static final int P_Goal__S
public static final int P_S__C_C
public static final int P_C__c_C
public static final int P_C__d
Constructor Detail |
public SccGrammar()
Method Detail |
public String getContext(int ID)
LRTranslatorGrammar
null
if no such ID is known.getContext
in interface LRTranslatorGrammar
public int getContextAction(int cID, int tID)
LRTranslatorGrammar
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.getContextAction
in interface LRTranslatorGrammar
public int getContextRegister(int cID, int tID)
LRTranslatorGrammar
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.getContextRegister
in interface LRTranslatorGrammar
public IntArray getContextTerminals(int ID)
LRTranslatorGrammar
null
if no such ID is known.getContextTerminals
in interface LRTranslatorGrammar
public IntArray getContexts()
LRTranslatorGrammar
IntArray
.getContexts
in interface LRTranslatorGrammar
public int getGoalNonTerminal()
LRTranslatorGrammar
UNDEFINED_NONTERMINAL
is no such goal symbol has
been set.getGoalNonTerminal
in interface LRTranslatorGrammar
public String getName()
TranslatorGrammar
Translator
.getName
in interface TranslatorGrammar
public String getNonTerminal(int ID)
LRTranslatorGrammar
null
if no such ID is known.getNonTerminal
in interface LRTranslatorGrammar
public IntArray getNonTerminals()
LRTranslatorGrammar
IntArray
.getNonTerminals
in interface LRTranslatorGrammar
public String getProduction(int ID)
LRTranslatorGrammar
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.getProduction
in interface LRTranslatorGrammar
public int getProductionLength(int ID)
LRTranslatorGrammar
UNDEFINED_PRODUCTION
if no such ID is known.getProductionLength
in interface LRTranslatorGrammar
public int getProductionNonTerminal(int ID)
LRTranslatorGrammar
productionID
or
UNDEFINED_PRODUCTION
if no such production is known.getProductionNonTerminal
in interface LRTranslatorGrammar
public IntArray getProductionSymbols(int ID)
LRTranslatorGrammar
IntArray
or null
if no such ID is known.getProductionSymbols
in interface LRTranslatorGrammar
public IntArray getProductions()
LRTranslatorGrammar
IntArray
.getProductions
in interface LRTranslatorGrammar
public int getStartContext()
LRTranslatorGrammar
getStartContext
in interface LRTranslatorGrammar
public String getTerminal(int ID)
LRTranslatorGrammar
null
if no such ID is known.getTerminal
in interface LRTranslatorGrammar
public IntArray getTerminalContexts(int ID)
LRTranslatorGrammar
getTerminalContexts
in interface LRTranslatorGrammar
public Object getTerminalRegexp(int ID)
LRTranslatorGrammar
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.getTerminalRegexp
in interface LRTranslatorGrammar
public IntArray getTerminals()
LRTranslatorGrammar
IntArray
.getTerminals
in interface LRTranslatorGrammar
public String getVersion()
TranslatorGrammar
getVersion
in interface TranslatorGrammar
public Translator newTranslator()
TranslatorGrammar
Translator
for this
TranslatorGrammar
having some default set of
properties.newTranslator
in interface TranslatorGrammar
public Translator newTranslator(Properties p)
TranslatorGrammar
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.newTranslator
in interface TranslatorGrammar
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |