https://github.com/da-tubi/antlr4-scala-examplegithub.com
所有的构建相关的代码都在build.sc里面。
第一步:从g4文件生成Java代码
bin/mill antlr4.genAntlr
第二步:生成用于Intellij Idea的配置文件
bin/mill mill.scalalib.GenIdea/idea
然后我们就可以直接用Intellij Idea直接打开这个项目了,可以愉快地在Intellij Idea编辑所有的源代码文件和构建定义,不需要像使用sbt那样等待很久。
第三步:运行example模块中的 arithmetic.ArithmeticVisitorTest
bin/mill example.run
mill还是比较好用的,大家可以对于一下build.sbt和build.sc
https://github.com/colin4124/antlr4-scala-example/blob/master/build.sbtgithub.com https://github.com/da-tubi/antlr4-scala-example/blob/master/build.scgithub.com后面有空可以写一个mill-antlr4插件。
欢迎来参加线上的Scala Meetup (2020/09/05)
我是其中一个speaker。
比图科技:2020年9月 Online Scala Meetupzhuanlan.zhihu.com