3 ms·
ANTLR4 automatically generates a visitor for your grammar that you can use to translate into your own idiomatic objects: http://jakubdziworski.github.io/java/20
by electrum 10y ago
ANTLR4 automatically generates a visitor for your grammar that you can use to translate into your own idiomatic objects: http://jakubdziworski.github.io/java/2016/04/01/antlr_visitor_vs_listener.html http://jakubdziworski.github.io/java/2016/04/01/antlr_visito...
We use this in Presto for parsing SQL and generating an immutable AST:
https://github.com/prestodb/presto/blob/master/presto-parser/src/main/antlr4/com/facebook/presto/sql/parser/SqlBase.g4 https://github.com/prestodb/presto/blob/master/presto-parser...
https://github.com/prestodb/presto/blob/master/presto-parser/src/main/java/com/facebook/presto/sql/parser/AstBuilder.java https://github.com/prestodb/presto/blob/master/presto-parser...