Generic Interpreter 1.2
Private API

gi
Class LR1_Grammar.Contexts

java.lang.Object
  extended bygi.Lexicon.Stack
      extended bygi.Lexicon.Set
          extended bygi.LR0_Grammar.Contexts
              extended bygi.LR1_Grammar.Contexts
Enclosing class:
LR1_Grammar

static class LR1_Grammar.Contexts
extends LR0_Grammar.Contexts

This class implements a set of LR(1) Contexts.

Version:
1.2
Author:
© 1999-2004 Craig A. Rich <carich@csupomona.edu>

Field Summary
(package private)  Object[] get
          The objects on this Stack.
(package private)  int size
          The number of objects on this Stack.
 
Constructor Summary
(package private) LR1_Grammar.Contexts()
           
 
Method Summary
private  int add(Grammar.Production p, int lookahead, Lexicon.Set follow)
          Adds an LR(1) Context to this set of LR(1) Contexts.
(package private)  boolean add(Lexicon.Set S)
          Adds a Set of objects to this Set.
(package private)  boolean add(Lexicon.Set S, int start)
          Adds a Set of objects to this Set.
(package private)  boolean add(Object object)
          Adds an object to this Set.
(package private)  boolean contains(Object object)
          Indicates whether an object occurs in this Set.
(package private)  Object pop()
          Pops and returns the top object of this Stack.
private  int push(Grammar.Production p, int lookahead, Lexicon.Set follow)
          Pushes an LR(1) Context onto this set of LR(1) Contexts.
(package private)  boolean push(Object object)
          Pushes an object onto this Stack.
(package private)  Object top()
          Returns the top object of this Stack.
 String toString()
          Returns the string representation of this set of LR(0) Contexts.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

get

Object[] get

The objects on this Stack.


size

int size

The number of objects on this Stack.

Constructor Detail

LR1_Grammar.Contexts

LR1_Grammar.Contexts()
Method Detail

add

private int add(Grammar.Production p,
                int lookahead,
                Lexicon.Set follow)

Adds an LR(1) Context to this set of LR(1) Contexts. The capacity is expanded if necessary.

Parameters:
p - the Production in the Context added.
lookahead - the lookahead position in the Context added.
follow - the follow Set in the Context added.
Returns:
the index in this set of LR(1) Contexts at which the Context occurs if this set of LR(1) Contexts changed; otherwise the size of this set of LR(1) Contexts.

push

private int push(Grammar.Production p,
                 int lookahead,
                 Lexicon.Set follow)

Pushes an LR(1) Context onto this set of LR(1) Contexts. The capacity is expanded by 100 if necessary.

Parameters:
p - the Production in the Context pushed.
lookahead - the lookahead position in the Context pushed.
follow - the follow Set in the Context pushed.
Returns:
the index in this set of LR(1) Contexts at which the pushed Context occurs.

toString

public String toString()

Returns the string representation of this set of LR(0) Contexts.

Overrides:
toString in class Lexicon.Stack
Returns:
the string representation of this set of LR(0) Contexts.

add

boolean add(Lexicon.Set S)

Adds a Set of objects to this Set. An object is not added if it occurs in this Set or it is null and the null exclusion indicator is true. The capacity is expanded if necessary.

Parameters:
S - the Set to add to this Set.
Returns:
true if this Set is changed; false otherwise.

add

boolean add(Lexicon.Set S,
            int start)

Adds a Set of objects to this Set. An object is not added if it occurs in this Set or it is null and the null exclusion indicator is true. The capacity is expanded if necessary.

Parameters:
S - the Set to add to this Set.
start - the index in S beyond which objects are added.
Returns:
true if this Set is changed; false otherwise.

add

boolean add(Object object)

Adds an object to this Set. The object is not added if it occurs in this Set or it is null and the null exclusion indicator is true. The capacity is expanded if necessary.

Parameters:
object - the object to add to this Set.
Returns:
true if this Set is changed; false otherwise.

contains

boolean contains(Object object)

Indicates whether an object occurs in this Set.

Parameters:
object - the object whose membership if requested.
Returns:
true if o occurs in this Set; false otherwise.

pop

Object pop()

Pops and returns the top object of this Stack.

Returns:
the top object of this Stack.

push

boolean push(Object object)

Pushes an object onto this Stack. The capacity is expanded by 50% if necessary.

Parameters:
object - the object to push onto this Stack.
Returns:
true indicates this Stack is changed.

top

Object top()

Returns the top object of this Stack.

Returns:
the top object of this Stack.

 

© 1999-2004 Craig A. Rich <carich@csupomona.edu>