Generic Interpreter 1.2
Public API

gi
Class Grammar

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

public class Grammar
extends Lexicon

This class implements a Grammar.

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

Method Summary
 void interpret(String[] arguments)
          Interprets by command-line arguments using this Grammar.
 
Methods inherited from class gi.Lexicon
interpret, interpret, interpret, interpret, interpret, interpret
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

interpret

public void interpret(String[] arguments)

Interprets by command-line arguments using this Grammar. When interpreting, the parser used will be (in order):

  • The parser most recently constructed by preceding command-line arguments.
  • The parser originally around this Grammar.
  • An LR(1) parser.
The first I/O, lexical, syntax or semantic error that occurs when interpreting is printed to the standard error stream.

Overrides:
interpret in class Lexicon
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 Grammar before subsequent syntax analyses.
-l, --lexical
Print terminals in this Grammar grabbed during subsequent syntax analyses.
-f, --firstfollow
Print first and follow sets precomputed during subsequent syntax analyses.
-s, --syntax
Print parsing decisions made during subsequent syntax analyses.
-c, --conflict
Print parsing conflicts encountered during subsequent syntax analyses.
-p, --parsetree, --tree
Print each ParseTree produced by subsequent syntax analyses.
-v, --verbose
Print maximum debugging. Equivalent to -tlfscp.
--ll1
Construct an LL(1) parser around this Grammar.
--lr0
Construct an LR(0) parser around this Grammar.
--slr1
Construct an SLR(1) parser around this Grammar.
--lr1
Construct an LR(1) parser around this Grammar.
-
Interpret the standard input stream using this Grammar.
filename
Interpret source file filename using this Grammar.
If no filename arguments are given, the standard input stream is interpreted.

 

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