|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--xrel.analyzer.Translate
Provides several transform operations to the symbol table.
In details:
To know more see the descriptions of the methods.
N.B.: This is a static class so you will never need to allocate an object of this class.
Fields inherited from interface xrel.parser.XRelParserTreeConstants |
JJTAS, JJTCASE, JJTCOMMA, JJTEMPTY, JJTEXPORTTP, JJTIDENTIFIER, JJTIMPORTST, jjtNodeName, JJTOPERATOR, JJTPAR, JJTPROGRAM, JJTSTATEMENTLIST, JJTSTRING, JJTSTRINGLITERAL, JJTSWITCHCASE, JJTTAG, JJTTYPEDECL, JJTVOID |
Fields inherited from interface xrel.parser.SymElementKind |
EXPRESSION, LABEL, PATTERN, S_EXPRESSIONS, S_LABELS, S_PATTERNS, S_TYPES, S_VARIABLES, TYPE, UNDEFINED, VARIABLE |
Fields inherited from interface xrel.parser.SpecialNames |
AnyTagName, AnyTypeName, AutomatonPrefix, EmptyPatternName, ExportTypeName, ExpressionPrefix, PatternPrefix, SpecialPrefix, StringName, StringPatternName, StringTypeName, StrLiteralPrefix, StrLiteralSuffix, StrUnquotedPrefix, StrUnquotedSuffix |
Constructor Summary | |
Translate()
|
Method Summary | |
static void |
addPredefined(SymTable st)
Adds the predefined type "Any" to the symbol table. |
static void |
desugar(SymTable st)
Performs a few simplifications to all the elements in the symbol table: types, patterns, variable types and expressions. |
static SimpleNode |
desugarElement(SymTable st,
SimpleNode node)
Removes the operators "+" and "?" |
static void |
diagnosticChecks(SymTable st,
int phase)
Perform diagnostic checks on the elements inside the symbol table. |
static void |
normalization(SymTable st)
Internalizes all the patterns of the program, that is it transformes them in an internal format so that they can be easily transformed in automata. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Translate()
Method Detail |
public static void addPredefined(SymTable st)
Adds the predefined type "Any" to the symbol table. Remember that Any is defined as in the following:
typedef Any = (~[Any] | String)*;
st
- the symbol tablepublic static void desugar(SymTable st)
Performs a few simplifications to all the elements in the symbol table: types, patterns, variable types and expressions.
Specifically it performs the following transformations:
N.B.:
st
- the symbol tablepublic static SimpleNode desugarElement(SymTable st, SimpleNode node)
The names chosen for pseudo-labels are #String[] for String and #".." for string literals. Note that initial symbol grants that it's impossibile to have name conflicts with normal labels, as XML tag names never begin with "#" symbol (labels in XRel follow the same syntactic conventions as XML names).
Operators are removed in the following way:N.B.:
st
- the symbol tablenode
- the root node of the subtree to changepublic static void normalization(SymTable st)
Internalizes all the patterns of the program, that is it transformes them in an internal format so that they can be easily transformed in automata.
In details it makes the following changes to the patterns:
The resulting patterns have the following syntax:
where x,.. ranges over variable names and X,.. ranges over pattern references. Substantially there are no more type names (because they've been expanded) and each tag content corresponds to a specifical pattern. These are exactly the changes this function does.P ::= P as x variable binder l[X] label () empty pattern P,P concatenation P|P choice P* repetition
N.B.:
st
- the symbol tablepublic static void diagnosticChecks(SymTable st, int phase)
The phase parameter can be one of the following:
st
- the simbol tablephase
- the phase after which is called
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |