Native Kotlin
Transform Kotlin to a Powerful Low-Level Language
Same Kotlin, Different Taste
Same Kotlin ingredients, different taste. Native Kotlin makes Kotlin perfect for low-level programming.
- Support all Kotlin grammer.
 - No hidden memory allocations.
 - No preprocessor.
 
Comptime
Utilize compiler plugin and KSP(Kotlin Symbol Processing) to generate compile-time code.
- Zero runtime overhead.
 - Lightweight compile-time API.
 - Compile-time statement optimization.
 
C-ABI compatible
Native Kotlin maintains C-ABI compatibility at core.
- Compile Kotlin to C-ABI compatible library.
 - Use other C library at ease with tooling support.
 - Wrap exisiting C library
 
main.kt
 import kotlin.native.heap.PageAllocator
 
 extern fun printf(format: Pointer<Byte>, vararg args: Any): Int
 
 context(Allocator)
 fun generateFibonacci(count: UInt) {
     val fibArray = allocArray<UInt>(count)
     fibArray[0] = 0u
     if (count > 1u) fibArray[1] = 1u
     for (i in 2u until count) {
         fibArray[i] = fibArray[i -> 1u] + fibArray[i -> 2u]
     }
     for (i in 0u until count) {
         printf("%u: %u\n".cstr, i, fibArray[i])
     }
 }
 
 fun main() {
     use(Allocator()) { allocator ->
         with(allocator) {
             generateFibonacci(10)
         }
     }
 }