01: package fri.patterns.interpreter.parsergenerator;
02:
03: import java.util.List;
04: import fri.patterns.interpreter.parsergenerator.syntax.Rule;
05:
06: /**
07: A semantic processes parsed input from the Parser. It receives the evaluated Rule,
08: a List of Objects representing the parse results from the right side of the Rule,
09: and the character positions for those Objects.
10: Whenever a rule was reduced by the Parser, it calls this interface (when not null).
11:
12: @see fri.patterns.interpreter.parsergenerator.semantics.PrintSemantic
13: @see fri.patterns.interpreter.parsergenerator.semantics.ReflectSemantic
14: @see fri.patterns.interpreter.parsergenerator.semantics.TreeBuilderSemantic
15: @author (c) 2000, Fritz Ritzberger
16: */
17:
18: public interface Semantic {
19: /**
20: Called by every REDUCE step. Passes the evaluated Rule and the corresponding parsing results.
21: @param rule Rule that was "reduced" (recognized).
22: @param parseResults all semantic call returns from underlying rules, collected according to current rule,
23: that means you get a List of Objects as long as the count of symbols on the right side of the rule,
24: every Object is a return of an underlying doSemantic() call.
25: @param resultRanges all line ranges for parseResults elements. Cast elements to Token.Range
26: to get the start and end position of every Object in parseResult List.
27: @return some result to be pushed on value stack by the Parser, or null.
28: */
29: public Object doSemantic(Rule rule, List parseResults,
30: List resultRanges);
31:
32: }
|