Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Making a Template Engine for Kotlin

Lukas
February 16, 2018
690

Making a Template Engine for Kotlin

Lukas

February 16, 2018
Tweet

Transcript

  1. About Me - Software Engineer @ M3 - 12 in

    Japan from Germany - Github: https://github.com/lukasjapan - Tech I like - Raspberry Pi - Kotlin/Java - Ruby - ... - Creator of “bt-speaker” - Bluetooth speaker Daemon for Raspberry Pi
  2. - Template Engine for Kotlin - Features - HAML style

    - High Performance - Type-Safe!! - Spring Integration - https://github.com/lukasjapan/koreander
  3. High Performance - Transpile into Kotlin Code - Compile to

    JVM Bytecode - Render by passing the View Model Template Kotlin Code Compiled JVM Code HTML View Model
  4. Type Safety Template Kotlin Code Compiled JVM Code HTML View

    Model Defining the ViewModel type Type checks, etc Because of Kotlins KType, type erasure is not an issue! forced cast
  5. Kotlin Script - Implementation of JSR-223 - (Scripting for the

    Java Platform) - Kotlin implementation - Run arbitrary Kotlin code - Compiled Scripts
  6. Steps for parsing templates - (Tokenizing) - Splitting input by

    white-space, newlines, etc - Lexing - Give meaning to the tokens - Parsing - Take the tokens and check for correct syntax - Build the code out of the Tokens
  7. Deploying a Java Library - JFrog - create maven repository

    - apply plugin to gradle - upload .jar - possibility to sync with JCenter - Including library