org.openmali.number
Class Parser

java.lang.Object
  extended by org.openmali.number.Parser

public class Parser
extends java.lang.Object

A hand written top down parser for Rational, Radicand1 and Matrix4 classes


Constructor Summary
Parser(java.io.Reader in)
           
 
Method Summary
 float floatNum()
          A floating point number of the form {+,-}?
 void fraction()
          FRACTION <= INTEGER { '/' NATURAL}?
 java.io.StreamTokenizer getTokenizer()
           
 int integer()
          INTEGER <- {+|-}?
 Matrix4rad matrix4rad()
          Reads a 4x4 radical matrix from the tokenizer [ [radicand x 4] x4]
 int natural()
          A posative integer (no signs infront of digits)
 Radical1 radicand1()
          RADICAND1 <- RADICAND1_TERM {"+" RADICAND1_TERM}*
 void radicand1Term()
          RADICAND1_TERM <- RATIONAL {"*" RADICAND} | RADICAND
 Rational rational()
          RATIONAL <- FRACTION || ( INTEGER +?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Parser

public Parser(java.io.Reader in)
Method Detail

getTokenizer

public java.io.StreamTokenizer getTokenizer()

matrix4rad

public Matrix4rad matrix4rad()
                      throws java.io.IOException
Reads a 4x4 radical matrix from the tokenizer [ [radicand x 4] x4]

Returns:
the read matrix
Throws:
java.io.IOException

radicand1

public Radical1 radicand1()
                   throws java.io.IOException
RADICAND1 <- RADICAND1_TERM {"+" RADICAND1_TERM}*

Returns:
the radical
Throws:
java.io.IOException

radicand1Term

public void radicand1Term()
                   throws java.io.IOException
RADICAND1_TERM <- RATIONAL {"*" RADICAND} | RADICAND

Throws:
java.io.IOException

rational

public Rational rational()
                  throws java.io.IOException
RATIONAL <- FRACTION || ( INTEGER +? FRACTION ) ||

Throws:
java.io.IOException

fraction

public void fraction()
              throws java.io.IOException
FRACTION <= INTEGER { '/' NATURAL}?

Throws:
java.io.IOException

integer

public int integer()
            throws java.io.IOException
INTEGER <- {+|-}? natural

Throws:
java.io.IOException

natural

public int natural()
            throws java.io.IOException
A posative integer (no signs infront of digits)

Throws:
java.io.IOException

floatNum

public float floatNum()
               throws java.io.IOException
A floating point number of the form {+,-}? (dddddddd)?.(dddddd)? {E {+,-}? NATURAL}? (no dangling f like in java

Returns:
the float
Throws:
java.io.IOException