From 20c33252089137206ab95348d8356ac978b0e8d0 Mon Sep 17 00:00:00 2001 From: Alexey Stepanov Date: Wed, 31 Aug 2016 23:20:44 +0300 Subject: [PATCH] Create README for translator --- translator/README.md | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 translator/README.md diff --git a/translator/README.md b/translator/README.md new file mode 100644 index 00000000000..637c19c4de9 --- /dev/null +++ b/translator/README.md @@ -0,0 +1,48 @@ +# Translator from Kotlin to LLVM + +## Building + +For build translator into jar, you must run gradle target + + $ ./gradlew jar + +**NOTE:** make sure you have jdk version 1.8 or higher + + +Assembled the translator can be found in the following folder + + $ cd build/libs/translator + +## Using compiler + $ java -jar $(PATH_TO_TRANSLATOR_JAR) -I $(PATH_TO_KOTLIB) $(KOTLIN_SOURCES) + where + - $(PATH_TO_TRANSLATOR_JAR) - path to jar, which you got in building step, by default it `build/libs/translator-1.0.jar` + - $(PATH_TO_KOTLIB) - path to standart kotlin lib, by default it `../kotstd/include` + - $(KOTLIN_SOURCES) - the different files that you want to compile + +### Optional arguments + - -M - specified entry point of your project, by default it is main + + **NOTE:** your entry point function should not receive arguments + + - -o - file to redirect output of the generated code + + +## Using generated code + +To execute the generated code you should use should link your code with kotlin native runtime. By default, you can find the appropriate library at +`../kotstd/build/stdlib_x86.ll` + +For linking, run the following command + + $ llvm-link-3.6 -S $(KOTLIN_NATIVE_RUNTIME) $(COMPILED_LLVM_CODE) + +where $(COMPILED_LLVM_CODE) - code obtained in the step compiler + +**NOTE:** The translator supports the llvm version number 3.6. Please make sure you have the correct version of llvm. + +## Run + + $ lli-3.6 $(LINKED_CODE) + +where $(LINKED_CODE) - code obtained in the previous step