Building Parsers with Java

sjm.examples.logic
Class StructureWithTermsAssembler

java.lang.Object
  |
  +--sjm.parse.Assembler
        |
        +--sjm.examples.logic.StructureWithTermsAssembler

public class StructureWithTermsAssembler
extends Assembler

Pops the terms and functor of a structure from an assembly's stack, builds a structure, and pushes it.


Constructor Summary
StructureWithTermsAssembler()
           
 
Method Summary
static Term[] vectorReversedIntoTerms(java.util.Vector v)
          Reverse a vector into an array of terms.
 void workOn(Assembly a)
          Pops the terms and functor of a structure from an assembly's stack, builds a structure, and pushes it.
 
Methods inherited from class sjm.parse.Assembler
elementsAbove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructureWithTermsAssembler

public StructureWithTermsAssembler()
Method Detail

vectorReversedIntoTerms

public static Term[] vectorReversedIntoTerms(java.util.Vector v)
Reverse a vector into an array of terms.
Parameters:
Vector - the vector to reverse
Returns:
Term[] the vector, reversed

workOn

public void workOn(Assembly a)
Pops the terms and functor of a structure from an assembly's stack, builds a structure, and pushes it.

This method expects a series of terms to lie on top of a stack, with an open paren token lying underneath. If there is no '(' marker, this class will throw an EmptyStackException.

Beneath the terms of the structure, this method expects to find a token whose value is the functor of the structure.

Overrides:
workOn in class Assembler
Parameters:
Assembly - the assembly to work on

by Steve Metsker