itec.minicompiler
Class FollowSet

java.lang.Object
  extended byitec.minicompiler.FollowSet
All Implemented Interfaces:
ConstantsInterface

public class FollowSet
extends java.lang.Object
implements ConstantsInterface

The FollowSet implements the FOLLOW-Sets of all non-terminals in the grammar. As a most adequate structure the HashSet is used to implement a particular FOLLOW-Set of a non-terminal. In a Hashtable the several HashSets are brought together.

To get the several FOLLOW-Sets the algorithm in the book

"COMPILERS Principles, Techniques and Tools" by Aho, Sethi, Ullmann
was used. The entries were mainly calculated by hand.

Version:
1.0 (29.09.2004)
Author:
Stefan Leitner, Stefan Schauer

Field Summary
private  java.util.Hashtable follow
          The overall structure of all the FOLLOW-Sets.
 
Fields inherited from interface itec.minicompiler.ConstantsInterface
ACTUALPARAMETERS, AND, ARRAY, ARRAYTYPE, ASSIGNMENT, BECOMES, BEGIN, COLON, COMMA, CONST, DECLARATIONS, DIV, DO, ELSE, ELSIF, EMPTY, END, EPSILON, EQUAL, ERR_EXP_ARRAY, ERR_EXP_BECOMES, ERR_EXP_COLON, ERR_EXP_COMMA, ERR_EXP_DO, ERR_EXP_END, ERR_EXP_EQUAL, ERR_EXP_IDENT, ERR_EXP_IF, ERR_EXP_LPAREN, ERR_EXP_MODULE, ERR_EXP_OF, ERR_EXP_PERIOD, ERR_EXP_PROCEDURE, ERR_EXP_RBRAK, ERR_EXP_RECORD, ERR_EXP_REPEAT, ERR_EXP_RPAREN, ERR_EXP_SEMICOLON, ERR_EXP_THEN, ERR_EXP_UNTIL, ERR_EXP_WHILE, ERR_INV_FACTOR, ERR_INV_STATEMENT, ERR_INV_TYPE, ERR_INVALID_CHARACTER, ERR_NOT_EXP_DECLARATIONS, ERR_NOT_EXP_FACTOR, ERR_NOT_EXP_STATEMENT, ERR_NOT_EXP_TYPE, ERR_NOT_TERMINATED, ERR_NUMBER_TOO_HIGH, EXPRESSION, FACTOR, FIELDLIST, FORMALPARAMETERS, FPSECTION, GEQ, GREATER, IDENT, IDENTLIST, IF, IFSTATEMENT, KEYWORD, LBRAK, LEQ, LESS, LPAREN, MINICOMP, MINUS, MOD, MODULE, NOT, NOTEQUAL, NUMBER, OF, OR, PERIOD, PLUS, PROCEDURE, PROCEDUREBODY, PROCEDURECALL, PROCEDUREDECLARATION, PROCEDUREHEADING, RBRAK, RECORD, RECORDTYPE, REPEAT, REPEATSTATEMENT, RPAREN, SELECTOR, SEMICOLON, SIMPLEEXPRESSION, SINGLE, STATEMENT, STATEMENTSEQUENCE, TERM, THEN, TIMES, TYP, TYPE, UNTIL, VAR, WHILE, WHILESTATEMENT
 
Constructor Summary
FollowSet()
          Initialize the FOLLOW-Set of each particular non-terminal in the grammar.
 
Method Summary
 java.util.HashSet getFollow(int nonTerminal)
          Return the FOLLOW-Set of a nonTerminal.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

follow

private java.util.Hashtable follow
The overall structure of all the FOLLOW-Sets. The Hashtable contains the FOLLOW-Sets of the different non-terminals. Each entry is a HashSet as implementation of a FOLLOW-Set.

Constructor Detail

FollowSet

public FollowSet()
Initialize the FOLLOW-Set of each particular non-terminal in the grammar. The values of the several HashSets were mainly calculated by hand and checked for errors with JCoco.

Method Detail

getFollow

public java.util.HashSet getFollow(int nonTerminal)
Return the FOLLOW-Set of a nonTerminal.

Parameters:
nonTerminal - A non-terminal in the grammar
Returns:
A HashSet implementing the FOLLOW-Set of nonTerminal