public class StructuralAnalyzer extends AbstractPhase
environment, runtimeData| Constructor and Description |
|---|
StructuralAnalyzer(Environment environment)
Construct an analizer given an environment
|
| Modifier and Type | Method and Description |
|---|---|
void |
execute() |
Set<Integer> |
getFirst(int nonTerminalId)
The first is the set of terminal symbols that a given non-terminal can
start with.
|
public StructuralAnalyzer(Environment environment)
environment - the Environment, shared between phases.public Set<Integer> getFirst(int nonTerminalId)
Look at the left side of all rules and, if the rule left hand matches the desired symbol, find the non-terminals that the symbol can start with. This is recursive. In addition, empty non-terminals appearing at the beginning of the rule require the review of the second one, etc.
given
ri: α → β
First(α) = ∪ First(β)In addition, for β = λδ
First (β):
if ∃ rj: λ → ∅ then First(β) = First(λ) ∪ First(δ)
nonTerminalId - is the non terminal to computepublic void execute()
throws AnalysisException
AnalysisExceptionCopyright © 2017. All rights reserved.