Robin Maisch e397677e2f Make R and Kotlin frontends more consistent -- continued před 4 roky
..
src e397677e2f Make R and Kotlin frontends more consistent -- continued před 4 roky
README.md 78bf634b5c Add link to README, small simplification to token transformation před 4 roky
pom.xml 1644cd10fc Make R and Kotlin frontends more consistent před 4 roky

README.md

JPlag Kotlin language frontend

The JPlag Kotlin frontend allows the use of JPlag with submissions in Kotlin.
It is based on the Kotlin ANTLR4 grammar, licensed under the Apache 2.0.

Kotlin specification compatibility

The underlying grammar definition does not specify which version of Kotlin it is built on, but the presence of the inline keyword and the lack of support for trailing commas in argument lists indicate that it complies with Kotlin 1.3, released in late 2018.

The grammar in this repo contains a fix and some modifications to allow for easier token generation, see the comment in the KotlinParser.

If there are any major updates or fixes to the grammar1, they should surely be applied to this module as well.

Token Extraction

The choice of tokens is intended to be similar to the Java or C# frontends. It includes a range of nesting structures (class, method, control flow expressions) as well as variable declaration, object creation, assignment, and control flow altering keywords.

More syntactic elements of Kotlin may turn out to be helpful to include in the future.

Usage

To use the Kotlin frontend, add the -l kotlin flag in the CLI, or use a JPlagOption object set to LanguageOption.KOTLIN in the Java API as described in the usage information in the readme of the main project and in the wiki.


Footnotes

1 The grammar files are taken from grammar-v4, with the most recent modification in commit 9644ff9 from February 2021.