public class GllParser extends java.lang.Object implements GearleyParser
The GLL parser compares an input sequence against a grammar and determines if the input is a sentence in the grammar.
This is an attempt to implement the work described in Derivation representation using binary subtree sets by Elizabeth Scott, Adrian Johnstone, and L. Thomas van Binsbergen. It returns the SPPF style forest derived from the binary subtrees. (There's some aspect of the description of how to extract trees directly from the BSR that I cannot grok.)
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
gllexecution |
ParserGrammar |
grammar |
static java.lang.String |
logcategory |
| Constructor and Description |
|---|
GllParser(ParserGrammar grammar,
ParserOptions options) |
| Modifier and Type | Method and Description |
|---|---|
int |
getColumnNumber()
Returns the column number of the last character on the last line read by the parser.
|
ParserGrammar |
getGrammar()
The grammar used by this parser.
|
int |
getLineNumber()
Returns the line number of the last line read by the parser.
|
int |
getOffset()
Returns the last offset read by the parser.
|
ParserType |
getParserType()
The parser type.
|
NonterminalSymbol |
getSeed()
The seed used by this parser.
|
Token[] |
getTokens() |
boolean |
hasMoreInput()
Returns true of the parse ended without consuming all input.
|
GllResult |
parse(java.util.Iterator<Token> input)
Parse a sequence of tokens provided by an iterator.
|
GllResult |
parse(java.lang.String input)
Parse a string.
|
GllResult |
parse(Token[] input)
Parse an array of tokens.
|
boolean |
succeeded() |
public static final java.lang.String logcategory
public static final java.lang.String gllexecution
public final ParserGrammar grammar
public GllParser(ParserGrammar grammar, ParserOptions options)
public GllResult parse(Token[] input)
GearleyParserNote that the GLL parser only parses character tokens.
parse in interface GearleyParserinput - The array of tokens.public GllResult parse(java.util.Iterator<Token> input)
GearleyParserNote that the GLL parser only parses character tokens.
parse in interface GearleyParserinput - The token iterator.public GllResult parse(java.lang.String input)
GearleyParserparse in interface GearleyParserinput - The input string.public boolean succeeded()
public Token[] getTokens()
public ParserType getParserType()
GearleyParsergetParserType in interface GearleyParserpublic ParserGrammar getGrammar()
GearleyParsergetGrammar in interface GearleyParserpublic NonterminalSymbol getSeed()
GearleyParsergetSeed in interface GearleyParserpublic boolean hasMoreInput()
GearleyParserhasMoreInput in interface GearleyParserpublic int getOffset()
GearleyParsergetOffset in interface GearleyParserpublic int getLineNumber()
GearleyParsergetLineNumber in interface GearleyParserpublic int getColumnNumber()
GearleyParsergetColumnNumber in interface GearleyParser