Skip to content
skotch
...

Debugging

Use javap (from the JDK) to disassemble compiled class files:

Terminal window
skotch emit --target jvm hello.kt -o HelloKt.class
javap -c HelloKt.class

Use dexdump (from the Android SDK build-tools) to inspect DEX output:

Terminal window
skotch emit --target dex hello.kt -o classes.dex
dexdump -d classes.dex

The LLVM IR output is human-readable text:

Terminal window
skotch emit --target llvm hello.kt -o hello.ll
cat hello.ll

Use --norm-out to write a normalized text form alongside binary output. This strips cosmetic differences and makes the structure easier to read:

Terminal window
skotch emit --target jvm hello.kt -o HelloKt.class --norm-out hello.norm.txt
cat hello.norm.txt

The REPL is useful for testing individual functions and expressions:

Terminal window
skotch repl
skotch> fun double(x: Int): Int = x * 2
skotch> println(double(21))
42

Declarations accumulate across turns, so you can build up state incrementally and test as you go.

Skotch prints diagnostics to stderr when compilation fails. Common categories:

ErrorMeaning
Parse errorSyntax not recognized (check for unsupported features)
Unresolved referenceFunction or variable name not found
Type mismatchArgument type doesn’t match parameter type
Feature not yet supportedUsing a Kotlin feature that Skotch doesn’t compile yet