org.inxar.syntacs.analyzer
Interface Symbol
- All Known Implementing Classes:
- AbstractSymbol, StringSymbol, Regexp
- public interface Symbol
Symbol
is an abstraction of either a terminal or a
nonterminal. Terminal Symbol
instances are typically constructed as
within a LexerInterpreter
and nonterminal Symbol
instances within
the ParserInterpreter
. These form the nodes of an [abstract] syntax
tree.
The value returned from the getSymbolType()
corresponds to a grammar constant, typically one allocated by a
TranslatorGrammar
or a constant in a
TranslatorGrammar
class that has been generated
(T_XXX
or N_XXX
).
getSymbolType
public int getSymbolType()
- Returns the symbol type.
setSymbolType
public void setSymbolType(int type)
- Sets the symbol type. This method is necessary because the
design of the shift-reduce parser interacts with the symbol
such that it automatically sets the type of the symbol returned
to the parser after a reduction to the correct nonterminal
(such that the user doesn't have to worry about it).