Building Parsers with Java

sjm.examples.sling
Class NumAssembler

java.lang.Object
  |
  +--sjm.parse.Assembler
        |
        +--sjm.examples.sling.NumAssembler

public class NumAssembler
extends Assembler

Pops a number token, and pushes a number function.

A design principle for this package is that "everything" is a two-dimensional function of time. Thus if the stack contains, say, a token that is just the number 3, this assembler will push a new Cartesian function (t, 3). This allows, for example, a Sling statement like plot 3; to be meaningful. In this case, the Sling design principles will use 3 as the y component of a function, and will use time as the x component. The plot will be of a line segment from (0, 3) to (1, 3), since time varies from 0 to 1 during the course of a plot.


Constructor Summary
NumAssembler()
           
 
Method Summary
 void workOn(Assembly a)
          Pop a number n, and push the function (t, n).
 
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

NumAssembler

public NumAssembler()
Method Detail

workOn

public void workOn(Assembly a)
Pop a number n, and push the function (t, n).
Overrides:
workOn in class Assembler
Parameters:
Assembly - the assembly to work on

by Steve Metsker