Class LRStack

java.lang.Object
  |
  +--LRStack

public class LRStack
extends java.lang.Object

This class implements the behavior of a stack appropriate for LR parsing.


Constructor Summary
LRStack()
           
 
Method Summary
 int peek()
          Returns the top symbol on the stack, without popping it.
 void pop()
          Pops the stack without returning anything.
 void push(int s)
          Pushes a state onto the stack.
 void push(java.lang.String A)
          Pushes a left-hand-side symbol onto the stack.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LRStack

public LRStack()
Method Detail

push

public void push(java.lang.String A)
Pushes a left-hand-side symbol onto the stack.

Parameters:
A - the LHS symbol

push

public void push(int s)
Pushes a state onto the stack.


pop

public void pop()
Pops the stack without returning anything.


peek

public int peek()
         throws java.lang.Exception
Returns the top symbol on the stack, without popping it.

Throws:
java.lang.Exception - if top symbol is not an integer (state)

toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object