hogoww / Illicium

Translation from Pharo to C
3 stars 1 forks source link

Illicium

/!\ Everything in this repository is very outdated. I do not currently plan to work on it any further. This was the support to write my PHD thesis.

Publication supported by Illicium: Illicium A modular transpilation toolchain from Pharo to C (IWST'19) https://hal.archives-ouvertes.fr/hal-02297860/

Differential Testing of Simulation-Based Virtual Machine Generators (Short version SAC'22) https://dl.acm.org/doi/abs/10.1145/3477314.3507171 (Long version ICSR'22) https://link.springer.com/chapter/10.1007/978-3-031-08129-3_7 !/

This projects aims to translate a subset to be defined of Pharo to C, to develop the Pharo Virtual Machine.

To generate tests: Download a Pharo 8 image (lastest Pharo 9 has AST modification I didn't update yet).

git clone git@github.com:hogoww/OpenSmalltalk-VM

checkout the testTranslation branch. add it to the image and install it.

git clone git@github.com:hogoww/Illicium (<- private repository)

add it and install it in the image.

Open a Playground and type:

MAIlliciumTranslator new vmDependentCode; generateTestClass: VMSpurOldSpaceStructureTest

Inspecting it will show you the generated code for the implementation file. The class header and implementation files will be generated by default in the same diretory as your image.

You can then use it with hogoww/OpenSmalltalk:compileInHeader to make it run on the VM !

git clone git@github.com:hogoww/OpenSmalltalk-VM
git checkout compileInHeader

#you may need to give the execution right to the script
./compile.sh
cd testCompilation

execute the compile command found in the root of the repository in quomand.txt

#set the ld flag, see how in ./compile.sh
./main

Note that curently the test contains error, which I am fixing. You can only run the test testing for the number of segments. And you have to declare the setup/teardown as extern.

/ very _ outdated / Translation happens in ASTC-Translation and ASTC-Kernel. ASTC-Translation implements how to translate each kind of Pharo AST node using a visitor. It also implements the translation of classes. ASTC-Kernel implements classes used to translate the messages.

Tests are currently being added in Translation-tests, by translating plugins for the virtual machine. They therefore depend on the pharo-project/opensmalltalk-vm, and load the CMakeVMMaker package.

ASTC-VisitorRB are visitors applied on the Pharo AST before the translation, such as the typing of the AST. ASTC-VisitorASTC are visitor applied on the result, such as the pretty printing to C code.

Phineas is the type inferencer currently used. It's an external dependency which will be installed by the baseline.

/!\ Currently we don't get C compilation errors on the Pharo side. We use GCC. The name of the iceberg project is used in the compilation command line, you can change it in : ASTC-Translation : ASTCFilePrinter >> CompileExternalPlugin Didn't find a solution to that problem yet.