Generic Interpreter 0.9
Protected API

gi
Class LR0_Grammar

java.lang.Object
  |
  +--gi.Lexicon
        |
        +--gi.Grammar
              |
              +--gi.LR0_Grammar
Direct Known Subclasses:
LR1_Grammar, SLR1_Grammar

public class LR0_Grammar
extends Grammar

This class implements an LR(0) 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(0) parsing is not very practical, since it ignores lookahead information and is easily confused, but it forms a basis around which SLR(1) and LR(1) parsers are constructed.

Version:
0.9
Author:
© 1999-2000 Craig A. Rich <carich@acm.org>
See Also:
Source code

Inner classes inherited from class gi.Grammar
Grammar.ParseTree, Grammar.Semantics
 
Inner classes inherited from class gi.Lexicon
Lexicon.Concatenation, Lexicon.Exception, Lexicon.Match, Lexicon.NonMatch, Lexicon.PosixClass, Lexicon.Range, Lexicon.Repetition, Lexicon.Singleton, Lexicon.UnicodeCategory, Lexicon.Union
 
Fields inherited from class gi.Lexicon
END_OF_SOURCE
 
Constructor Summary
protected LR0_Grammar()
          Constructs an LR(0) parser around a new empty Grammar.
protected LR0_Grammar(Grammar grammar)
          Constructs an LR(0) parser around an existing Grammar.
 
Methods inherited from class gi.Grammar
grab, interpret, interpret, interpret, interpret, interpret, interpret, interpret, put, put
 
Methods inherited from class gi.Lexicon
expression, put, word
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LR0_Grammar

protected LR0_Grammar()

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


LR0_Grammar

protected LR0_Grammar(Grammar grammar)

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

Parameters:
grammar - the Grammar around which the parser is constructed.

 

© 1999-2000 Craig A. Rich <carich@acm.org>