Generic Interpreter 1.2
Public API

gi
Class Lexicon

java.lang.Object
  extended bygi.Lexicon
Direct Known Subclasses:
Grammar

public class Lexicon
extends Object

This class implements a Lexicon.

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

Method Summary
 Object interpret()
          Interprets the standard input stream using this Lexicon.
 Object interpret(File source)
          Interprets a source file using this Lexicon.
 Object interpret(InputStream source)
          Interprets a source byte stream using this Lexicon.
 Object interpret(PipedWriter source)
          Interprets a source pipe using this Lexicon.
 Object interpret(Reader source)
          Interprets a source character stream using this Lexicon.
 Object interpret(String source)
          Interprets a source string using this Lexicon.
 void interpret(String[] arguments)
          Lexical analysis by command-line arguments using this Lexicon.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

interpret

public Object interpret()
                 throws gi.Lexicon.Exception

Interprets the standard input stream using this Lexicon.

Returns:
the ParseTree constructed by interpreting the standard input stream.
Throws:
Lexicon.Exception - if an I/O, lexical, syntax or semantic error occurs.

interpret

public Object interpret(File source)
                 throws FileNotFoundException,
                        gi.Lexicon.Exception

Interprets a source file using this Lexicon.

Parameters:
source - the source file.
Returns:
the ParseTree constructed by interpreting source.
Throws:
FileNotFoundException - if the source file cannot be found.
Lexicon.Exception - if an I/O, lexical, syntax or semantic error occurs.

interpret

public Object interpret(InputStream source)
                 throws gi.Lexicon.Exception

Interprets a source byte stream using this Lexicon.

Parameters:
source - the source byte stream.
Returns:
the ParseTree constructed by interpreting source.
Throws:
Lexicon.Exception - if an I/O, lexical, syntax or semantic error occurs.

interpret

public Object interpret(PipedWriter source)
                 throws IOException,
                        gi.Lexicon.Exception

Interprets a source pipe using this Lexicon.

Parameters:
source - the source pipe.
Returns:
the ParseTree constructed by interpreting source.
Throws:
IOException - if the source pipe cannot be connected.
Lexicon.Exception - if an I/O, lexical, syntax or semantic error occurs.

interpret

public Object interpret(Reader source)
                 throws gi.Lexicon.Exception

Interprets a source character stream using this Lexicon.

Parameters:
source - the source character stream.
Returns:
the ParseTree constructed by interpreting source.
Throws:
Lexicon.Exception - if an I/O, lexical, syntax or semantic error occurs.

interpret

public Object interpret(String source)
                 throws gi.Lexicon.Exception

Interprets a source string using this Lexicon.

Parameters:
source - the source string.
Returns:
the ParseTree constructed by interpreting source.
Throws:
Lexicon.Exception - if an I/O, lexical, syntax or semantic error occurs.

interpret

public void interpret(String[] arguments)

Lexical analysis by command-line arguments using this Lexicon. The first I/O or lexical error that occurs during lexical analysis is printed to the standard error stream.

Parameters:
arguments - the command-line arguments controlling the interpreter.
The following arguments may appear zero or more times, are processed in order, and have the following effects:
-t, --terminals
Print the set of terminals in this Lexicon before subsequent lexical analyses.
-l, --lexical
Print terminals in this Lexicon grabbed during subsequent lexical analyses.
-v, --verbose
Print maximum debugging. Equivalent to -tl.
-
Lexically analyze the standard input stream using this Lexicon.
filename
Lexically analyze source file filename using this Lexicon.
If no filename arguments are given, the standard input stream is lexically analyzed.

 

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