Session

Advanced techniques for building Kotlin DSL(s)

How to create Kotlin DSL that looks like the syntax of a programming language?
In this talk, I would like to talk about advanced techniques for creating Kotlin DSL.
As an example, we will see how to build a DSL that looks like a Starlark programming language, a Python dialect used for writing build scripts for Bazel build system. This DSL is a declarative code generator that builds an abstract syntax tree of a Starlark language and then generates a formatted code based on it.
However, all the concepts described in this talk are applicable to any kind of Kotlin DSL(s) including ones for Android projects.
The example project was presented at BazelCon 2021, a Google conference about Bazel build system: https://youtu.be/dz-CFEwJuko
In addition, there is a blog post that shows the capabilities of this DSL: https://proandroiddev.com/304fa8b3680c
The source code is available on GitHub: https://github.com/Morfly/airin

Pavlo Stavytskyi

Sr. Staff Software Engineer at Turo | Google Developer Expert for Android, Kotlin

San Francisco, California, United States

Actions

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top