klyn.Application.compile
method
public static native compile(code as String) throws SyntaxError, TypeError, Exception
Description

Compiles a Klyn script provided as a string. <p> This is intended as the programmatic entry point for automation (including tests). The fragment inherits the imports visible at the call site, but not local variables. Compilation does not execute the fragment or add its declarations to the caller. The supplied String is compiled as-is, without additional reindentation. Triple-quoted literals remove their common margin when the String is created. </p>

Parameters
ParameterDescription
codeKlyn source code to compile.
Throws
  • SyntaxError if the code contains a syntax error.
  • TypeError if the code contains a type error.
  • Exception if compilation fails for any other reason.
Example
code = "x as Int = 1"
Application.compile(code)