Package | Description |
---|---|
org.stekikun.dolmen.codegen | |
org.stekikun.dolmen.debug |
This package contains generic utility functions to help debug
Dolmen-generated lexical analyzers and parsers.
|
org.stekikun.dolmen.unparam |
Modifier and Type | Method and Description |
---|---|
static Config |
Config.ofGrammar(Grammar grammar,
@Nullable Reporter reporter)
|
static SourceMapping |
GrammarOutput.output(Writer writer,
String className,
Config config,
Grammar grammar,
Grammars.PredictionTable predict)
Outputs to
writer the definition of a top-down
parser for the given grammar , provided the prediction table
predict has no conflicts. |
static SourceMapping |
GrammarOutput.outputDefault(Writer writer,
String className,
Grammar grammar,
Grammars.PredictionTable predict)
Same as
GrammarOutput.output(Writer, String, Config, Grammar, Grammars.PredictionTable)
with the default configuration Config.DEFAULT . |
Modifier and Type | Method and Description |
---|---|
String |
Derivation.display(Grammar grammar) |
static Derivation.Displayer |
Derivation.Displayer.ofGrammar(Grammar grammar,
int initialIndent)
The result is printed as if starting at column
initialIndent . |
Constructor and Description |
---|
DerivationGenerator(Grammar grammar)
This builds an object capable of generating derivations for the
given
grammar . |
Modifier and Type | Method and Description |
---|---|
Grammar |
Grammar.Builder.build() |
static Grammar |
Expansion.of(PGrammar pgrammar)
This performs the expansion (aka monomorphization) of the parametric
grammar
pgrammar , which must have been checked to be expandable beforehand. |
Modifier and Type | Method and Description |
---|---|
static Grammars.NTermsInfo |
Grammars.analyseGrammar(Grammar grammar,
@Nullable Grammars.Dependencies deps_,
@Nullable Reporter reporter)
Analyze the given
grammar and compute for every non-terminal
whether it is nullable, and the associated FIRST and FOLLOW
sets. |
static Grammars.Dependencies |
Grammars.dependencies(Grammar grammar)
Computes the map of dependencies between the non-terminals
of the given grammar, i.e. associates to every non-terminal in
grammar the set of non-terminals which appear in the
right-hand side of productions for this non-terminal. |
protected static Map<String,Set<String>> |
Grammars.first(Grammars.Dependencies deps,
Grammar grammar,
Set<String> nullable) |
protected static Map<String,Set<String>> |
Grammars.follow(Grammars.Dependencies deps,
Grammar grammar,
Set<String> nullable,
Map<String,Set<String>> first) |
protected static Set<String> |
Grammars.nullable(Grammars.Dependencies deps,
Grammar grammar)
NB: In all generality this is only a correct approximation, so
non-terminals which are not in the resulting state are not guaranteed
to always produce non-empty matches.
|
static Grammars.PredictionTable |
Grammars.predictionTable(Grammar grammar,
Grammars.NTermsInfo infos)
Constructs a prediction table for the given grammar.
|
Constructor and Description |
---|
Builder(Grammar grammar)
Creates a fresh builder for a partition table based
on the given
grammar |