hogoww / Illicium

Translation from Pharo to C
3 stars 1 forks source link

Simplify the use of Phineas #22

Open guillep opened 5 years ago

guillep commented 5 years ago

Right now it is not clear nor clean at all. The type inference seems to be mandatory now, without loading phineas nothing work.

Moreover, the piece of code putting together Phineas and the translator and everything was not clear... I came to write this but completely by trial and error:

translate: sourceCode
    | astPharo inferer type |
    astPharo := RBParser parseExpression: sourceCode.
    astPharo doSemanticAnalysis.

    inferer := PhineasInferer new.
    type := (inferer inferAST: astPharo methodNode) methodType.
    astPharo methodNode acceptVisitor: (ASTCTypeAnnotationAST new
        inferer: inferer;
        yourself).

    type accept: PIIsMethodTypeInterpreted new.
    ^ astPharo acceptVisitor: ASTCFromPharo new.
hogoww commented 5 years ago

Agreed, this was done too fast, as a poc, and i have to change it. I think i'll add a default type visitor that will just type everything as SmallIntegers, which will allow to have a (very bad) alternative to Phineas.

hogoww commented 4 years ago

Far from being enough imo, but the interface is now a lot cleaner.