fri.patterns.interpreter.parsergenerator
Interface Semantic

All Known Implementing Classes:
PrintSemantic, ReflectSemantic, SyntaxBuilderSemantic, TreeBuilderSemantic

public interface Semantic

A semantic processes parsed input from the Parser. It receives the evaluated Rule, a List of Objects representing the parse results from the right side of the Rule, and the character positions for those Objects. Whenever a rule was reduced by the Parser, it calls this interface (when not null).

Author:
(c) 2000, Fritz Ritzberger
See Also:
PrintSemantic, ReflectSemantic, TreeBuilderSemantic

Method Summary
 java.lang.Object doSemantic(Rule rule, java.util.List parseResults, java.util.List resultRanges)
          Called by every REDUCE step.
 

Method Detail

doSemantic

public java.lang.Object doSemantic(Rule rule,
                                   java.util.List parseResults,
                                   java.util.List resultRanges)
Called by every REDUCE step. Passes the evaluated Rule and the corresponding parsing results.

Parameters:
rule - Rule that was "reduced" (recognized).
parseResults - all semantic call returns from underlying rules, collected according to current rule, that means you get a List of Objects as long as the count of symbols on the right side of the rule, every Object is a return of an underlying doSemantic() call.
resultRanges - all line ranges for parseResults elements. Cast elements to Token.Range to get the start and end position of every Object in parseResult List.
Returns:
some result to be pushed on value stack by the Parser, or null.