Same Kotlin, Different Taste
Same Kotlin ingredients, different taste. Native Kotlin makes Kotlin perfect for low-level programming.
- Support all Kotlin grammar.
- No hidden memory allocations.
- No preprocessor.
Transform Kotlin to a Powerful
Low-Level Language
Same Kotlin ingredients, different taste. Native Kotlin makes Kotlin perfect for low-level programming.
Utilize compiler plugin and KSP (Kotlin Symbol Processing) to generate compile-time code.
Native Kotlin maintains C-ABI compatibility at core.
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[0u] = 0u
if (count > 1u) fibArray[1u] = 1u
for (i in 2u until count) {
fibArray[i] = fibArray[i - 1u] + fibArray[i - 2u]
}
for (i in 0u until count) {
printf("%u: %u
".cstr, i, fibArray[i])
}
}
fun main() {
use(Allocator()) { allocator ->
with(allocator) {
generateFibonacci(10u)
}
}
}Documentation Coming Soon...