kotlin-parser-antlr
v1.0.0
Published
Kotiln parser that generates a concrete syntax tree using, parser class generated by [ANTLR v4][] and kotlin grammar taken from [kotlinx/ast][].
Downloads
2
Readme
Kotlin parser
Kotiln parser that generates a concrete syntax tree using, parser class generated by ANTLR v4 and kotlin grammar taken from kotlinx/ast.
Build grammar
Follow these steps to build grammar classes:
- Download antlr4 grammar for Kotlin
- Download ANTLR tool itself
- Install Java 8 JRE or JDK
With everything setup, run the following BASH script to generate classes KotilnLexer
& KotlinParser
.
#! /bin/bash
out_dir=./src/kotlin
# cleanup previous built files
rm -r $out_dir
# build files
java -jar <PATH TO ANTLR JAR> \
-Dlanguage=JavaScript \
-no-listener \
-Xexact-output-dir \
-o $out_dir/ \
<PATH TO GRAMMAR>
# cleanup
rm $out_dir/*.interp
rm $out_dir/*.tokens