| Package | Description |
|---|---|
| ec.gp.ge |
| Modifier and Type | Class and Description |
|---|---|
class |
GrammarFunctionNode
A GrammarNode representing a GPNode in the GE Grammar.
|
class |
GrammarRuleNode
A GrammarNode representing a Rule in the GE Grammar.
|
| Modifier and Type | Field and Description |
|---|---|
protected ArrayList<GrammarNode> |
GrammarNode.children |
| Modifier and Type | Method and Description |
|---|---|
GrammarNode |
GrammarFunctionNode.getArgument(int index)
Returna given argument.
|
GrammarNode |
GrammarRuleNode.getChoice(int index)
Returns a given choice.
|
| Modifier and Type | Method and Description |
|---|---|
void |
GrammarFunctionNode.addArgument(GrammarNode arg)
Adds a given argument to the node.
|
void |
GrammarRuleNode.addChoice(GrammarNode choice)
Adds a choice to the children of this node.
|
void |
GrammarParser.enumerateGrammarTree(GrammarNode gn)
Run BFS to enumerate the whole grammar tree into all necessary
indices lists/hash-maps, we *need* to run BFS because the decoding of
the "GE array to tree" works in a BFS fashion, so we need to stick with that;
After enumeration, we will have four data-structures like these --
(1) productionRuleList (a flattened grammar tree):
grammar-tree ==> {rule-0, rule-1, ,,, rule-(n-1)}
(2) ruleToIndex:
rule-0 --> 0
rule-1 --> 1
,
,
rule-(n-1) --> (n-1)
(3) indexToRule (reverse of ruleToIndex):
0 --> rule-0
1 --> rule-1
,
,
n-1 --> rule-(n-1)
and then, last but not the least, the relative rule index --
(4) absIndexToRelIndex:
if we have two rules like " -> |
|
ArrayList |
GrammarParser.gatherFirstSets(GrammarNode gn,
GrammarNode parent)
Generate the FIRST-SET for each production rule and store them in the
global hash-table, this runs a DFS on the grammar tree, the returned ArrayList
is discarded and the FIRST-SETs are organized in a hash-map called
"ruleToFirstSet" as follows --
rule-0 --> {FIRST-SET-0}
rule-1 --> {FIRST-SET-1}
,
,
rule-(n-1) --> {FIRST-SET-(n-1)}
|
ArrayList |
GrammarParser.gatherFollowSets(GrammarNode gn,
GrammarNode parent)
We do not have any example grammar to test with FOLLOW-SETs,
so the FOLLOW-SET is empty, we need to test with a grammar
that contains post-fix notations;
this needs to be implemented properly with a new grammar.
|
void |
GrammarParser.gatherPredictSets(GrammarNode gn,
GrammarNode parent)
Populate the PREDICT-SET from the FIRST-SETs and the FOLLOW-SETs,
as we do not have FOLLOW-SET, so FIRST-SET == PREDICT-SET;
this needs to be implemented, when the FOLLOW-SETs are done properly.
|
void |
GrammarParser.populatePredictiveParseTable(GrammarNode gn)
Now populate the predictive-parse table, this procedure reads
hash-maps/tables for the grammar-rule indices, PREDICT-SETs etc,
and assigns the corresponding values in the predictive-parse table.
|
Copyright © 2014 Evolutionary Computation Laboratory at George Mason University. All rights reserved.