Create README for translator

This commit is contained in:
Alexey Stepanov
2016-08-31 23:20:44 +03:00
committed by GitHub
parent 4b9a449111
commit 20c3325208
+48
View File
@@ -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