xrel.analyzer
Class PatAutomata

java.lang.Object
  |
  +--xrel.analyzer.PatAutomata
All Implemented Interfaces:
SymElementKind

public class PatAutomata
extends java.lang.Object
implements SymElementKind

Contains the methods to build and show the automata associated to the patterns of the program.

To build the automata do the followings:

  1. first call buildAutomata()
  2. then call eps_elim_Automata()
  3. then call rem_unreachable_Automata()
  4. finally call complete_Automata()
These phases are separated for debug purpouses only. To show the automata call dumpAutomata().

N.B.:

Author:
Fabrizio Bisi

Fields inherited from interface xrel.parser.SymElementKind
EXPRESSION, LABEL, PATTERN, S_EXPRESSIONS, S_LABELS, S_PATTERNS, S_TYPES, S_VARIABLES, TYPE, UNDEFINED, VARIABLE
 
Constructor Summary
PatAutomata()
           
 
Method Summary
static void buildAutomata(SymTable st)
          Builds the automaton for every pattern in the symbol table.
static void completeAutomata(SymTable st)
          Final phase to build the automata associated to the patterns of the program.
static void dumpAutomata(SymTable st, java.io.PrintStream out)
          Writes the internal structure of the automata associated to the patterns of the symbol table.
static void eps_elim_Automata(SymTable st)
          Removes the espilon (or null) transitions in all the automata associated to the patterns of the symbol table.
static void rem_unreachable_Automata(SymTable st)
          Removes the unreachable states from all the automata associated to the patterns of the symbol table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatAutomata

public PatAutomata()
Method Detail

dumpAutomata

public static void dumpAutomata(SymTable st,
                                java.io.PrintStream out)

Writes the internal structure of the automata associated to the patterns of the symbol table. For each automaton it writes out the set of the states, the subsets of initial and final states and the transitions, both the normal and the espilon transitions. Additionally it shows a few statistics on it (number of states and number of transitions).

It simply calls the method dump on the tree automata associated to each pattern.

Parameters:
st - the symbol table
out - the place where to print out
See Also:
TA.dump(PrintStream out)

buildAutomata

public static void buildAutomata(SymTable st)

Builds the automaton for every pattern in the symbol table.

For each pattern it first calls the method build() and then it computes the epsilon closures calling the method compute_closures().

N.B.: to build all the automata do the followings:

  1. First call buildAutomata()
  2. Then call eps_elim_Automata()
  3. Then call rem_unreachable_Automata()
  4. Finally call complete_Automata()
These phases are separated for debug purpouses only.

Parameters:
st - the symbol table.
See Also:
TANormal.build(), TA.compute_closures()

eps_elim_Automata

public static void eps_elim_Automata(SymTable st)

Removes the espilon (or null) transitions in all the automata associated to the patterns of the symbol table.

It simply calls the method epsilon_elimination() on each single automaton.

Parameters:
st - the symbol table
See Also:
TA.epsilon_elimination()

rem_unreachable_Automata

public static void rem_unreachable_Automata(SymTable st)

Removes the unreachable states from all the automata associated to the patterns of the symbol table. Unreachable states are states that are not reachable from the initial states.

It simply calls the method remove_unreachable_states() on each single automaton.

Parameters:
st - the symbol table
See Also:
TA.remove_unreachable_states()

completeAutomata

public static void completeAutomata(SymTable st)

Final phase to build the automata associated to the patterns of the program. It makes coherent the data structures one each other, specifically for each state of an automaton it updates the set of transitions that exit from the state.

It simply calls the method completeAutomaton on each automaton.

Parameters:
st - the symbol table
See Also:
TA.completeAutomaton()