[Announce] Idris 2 - 0.2.1 release for the JVM

189 views
Skip to first unread message

mmhell...@gmail.com

unread,
Jul 20, 2021, 3:30:50 AM7/20/21
to Idris Programming Language
Hello all,

I am happy to announce the intial version for Idris 2 - 0.2.1 on the JVM. This is compiled from Idris 2 JVM bootstrap version.

Changes:
  • Compile initial Idris 2 compiler (0.2.1) with Idris 2 JVM bootstrap version targeting Java 8 bytecode
  • Add JVM backend
  • Support primtives such as system, IO, network, clock, buffer etc. for JVM backend
  • Eliminate tail recursion
  • Add debug information such as variable name, file name and line number in bytecode from Idris source
  • Compile Idris modules to Java classes at the bytecode level, Idris top level functions to static Java methods and Idris lambdas into Java lambdas with "invokedynamic" implementing Java `Function` interface.
  • Generate bytecode concurrently for modules
  • Generate classes with `toString` and property getters for Idris constructors
  • Infer types to avoid boxing and casting
  • Compile Idris list into a Java list
  • JVM foreign descriptors supporting static, instance, interface methods and constructor calls
To try it out:
To compile and run:
Main.idr:

module Main

%foreign "jvm:showInputDialog(java/lang/Object String),javax/swing/JOptionPane"
showInputDialog : String -> PrimIO String

main : IO ()
main = do
  name <- primIO $ showInputDialog "Name:"
  putStrLn $ "Hello " ++ name

$ idris2 Main.idr -o main

$ java -jar build/exec/main_app/main.jar
idris-jvm-run-screenshot.png
Hello Idris


Reply all
Reply to author
Forward
0 new messages