Generic Interpreter 1.3
Protected API

gi
Class LR1_Grammar

java.lang.Object
  extended by gi.Lexicon
      extended by gi.Grammar
          extended by gi.LR0_Grammar
              extended by gi.LR1_Grammar

public class LR1_Grammar
extends LR0_Grammar

This class implements an LR(1) parser around a Grammar. The parser adapts to changes in the underlying Grammar. Semantics in a phrase are evaluated during a bottom-up parse, from left to right after all subtrees rooted in the phrase have been constructed. Attributes throughout the phrase are available during evaluation. LR(1) parsing considers context-specific lookahead terminals to more accurately choose between applicable phrases. LR(1) parsing is the default method used for a Grammar around which no parser has been explicitly constructed, and is the recommended method.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class gi.Grammar
Grammar.ParseTree, Grammar.Semantics
 
Nested classes/interfaces inherited from class gi.Lexicon
Lexicon.Alphabet, Lexicon.Concatenation, Lexicon.Exception, Lexicon.Expression, Lexicon.Match, Lexicon.NonMatch, Lexicon.PosixClass, Lexicon.Range, Lexicon.Repetition, Lexicon.Singleton, Lexicon.UnicodeCategory, Lexicon.Union
 
Field Summary
 
Fields inherited from class gi.Grammar
CONFLICT, FIRST_FOLLOW, PARSE_TREE, SYNTAX
 
Fields inherited from class gi.Lexicon
$, debug, LEXICAL, TERMINALS, VERBOSE
 
Constructor Summary
protected LR1_Grammar()
          Constructs an LR(1) parser around a new empty Grammar.
protected LR1_Grammar(Grammar G)
          Constructs an LR(1) parser around an existing Grammar.
 
Method Summary
 String toString()
          Returns the string representation of this parser, specifically "LR(1)".
 
Methods inherited from class gi.Grammar
grab, interpret, put, put
 
Methods inherited from class gi.Lexicon
expression, interpret, interpret, interpret, interpret, interpret, interpret, put, word
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LR1_Grammar

protected LR1_Grammar()

Constructs an LR(1) parser around a new empty Grammar.


LR1_Grammar

protected LR1_Grammar(Grammar G)

Constructs an LR(1) parser around an existing Grammar.

Parameters:
G - the Grammar around which the parser is constructed.
Method Detail

toString

public String toString()

Returns the string representation of this parser, specifically "LR(1)".

Overrides:
toString in class LR0_Grammar
Returns:
the string representation of this parser, specifically "LR(1)".
Since:
1.1

 

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