ANTLR and Android

后端 未结 3 1781
抹茶落季
抹茶落季 2020-12-18 13:12

is there any guide how to use ANTLR on Android? I have found some ANTLR portation for Android but it looks like being without any tutorial or manual. Do you know where to fi

3条回答
  •  隐瞒了意图╮
    2020-12-18 13:47

    There is an Android Studio (actually IntelliJ) plug-in for this, called "ANTLR v4 grammar plugin".

    This tutorial worked for me.

    In short, simply copy grammar (a .g4 file) into your project, right-click on it > Configure ANTLR...

    From there you can select to generate Java or Kotlin files, which will compile and run once you added the runtime in your dependencies:

    implementation 'org.antlr:antlr4-runtime:4.7'
    

提交回复
热议问题