Generic Interpreter 0.9
Private API

gi
Class LR0_Grammar.State

java.lang.Object
  |
  +--gi.LR0_Grammar.State
Enclosing class:
LR0_Grammar

static class LR0_Grammar.State
extends Object

This class implements a State in an LR parser.

Version:
0.9
Author:
© 1999-2000 Craig A. Rich <carich@acm.org>

Field Summary
(package private)  LR0_Grammar.Context[] contexts
          The Contexts in this State.
(package private)  int size
          The number of Contexts in this State.
 
Constructor Summary
(package private) LR0_Grammar.State()
           
 
Method Summary
private  int add(Grammar.Production production, int position, Lexicon.Set follow)
          Adds a Context to this State.
private  int append(Grammar.Production production, int position, Lexicon.Set follow)
          Appends a Context to this State.
 String toString()
          Returns a string representation of this State.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

contexts

LR0_Grammar.Context[] contexts

The Contexts in this State.


size

int size

The number of Contexts in this State.

Constructor Detail

LR0_Grammar.State

LR0_Grammar.State()
Method Detail

add

private int add(Grammar.Production production,
                int position,
                Lexicon.Set follow)

Adds a Context to this State.

Parameters:
production - the Production to be added.
int - the progress position to be added.
follow - the follow Set to be added.
Returns:
the index in this State at which the Context occurs if this State changed; otherwise the size of this State.

append

private int append(Grammar.Production production,
                   int position,
                   Lexicon.Set follow)

Appends a Context to this State.

Parameters:
production - the Production to be appended.
int - the progress position to be appended.
follow - the follow Set to be appended.
Returns:
the index in this State at which the Context occurs.

toString

public String toString()

Returns a string representation of this State.

Overrides:
toString in class Object
Returns:
the string representation of this State.

 

© 1999-2000 Craig A. Rich <carich@acm.org>