On 04 Dec 2013, at 00:53, Bernardo Ezequiel Contreras <[email protected]>
wrote:
> Hi all,
> I see that ast-semantic is present in Pharo 2.0 but is not present in Pharo
> 3.0,
> so the question is
> How did you replace it?
> what do you use in Pharo 3.0?
>
We use the Semantic analysis phase of Opal. It’s exactly the same thing,
slightly different
implementation. It does a bit more as it needs to analyse correctly for
optimised blocks and
needs to do the tempVector/copying temp analysis for the closure model of Cog).
The class that does the analysis is OCASTSemanticAnalyzer (together with
OCASTClosureAnalyzer,
we visit a second time for tempVector vs. copying for escaping variables).
Analysis is triggered with
#doSemanticAnalysis on the RBProgramNode.
-> every method+block get a scope (see OCAbstractScope)
(this knows the defined vars and the hierarchy models ivar/class/global
lookup)
-> variables are represented as subclasses of OCAbstractVariable
-> the Variables AST node has a property binding for such a semantic variable
-> the semantic variable knows what kind of var it is, so it is easy to
implement #isTemp as
isTemp
^self binding isTemp
There is some preliminary work to model temp vs. ivar as AST node subclasses,
but Opal is
not using that and the implementation has some problems. This will see some
work soon, I think.
Marcus