Upgrade Java Grammar from ANTLR2 to ANTLR4

71 views
Skip to first unread message

Тимур Тибеев

unread,
Mar 26, 2017, 11:00:10 AM3/26/17
to checkstyle-devel
Hi, my name is Timur Tibeyev, this project sounds interesting to me. I want to write this project inside my proposal. Can you suggest, where I can start? As I understood, antlr is used to parse and analyse java class, is it righty?

Ilja Dubinin

unread,
Mar 26, 2017, 12:28:50 PM3/26/17
to checkstyle-devel
Hi,

We parse java code with antlr. It parses code and creates AST (abstract syntax tree).
I would suggest you to read something about lexical and syntax analyzers (usually part of articles/books about compilers), but do not go too deep. And antlr manuals (I believe it avaliable on atlrr site)

Do not hesitate to ask questions.

Roman Ivanov

unread,
Mar 27, 2017, 3:54:13 PM3/27/17
to Ilja Dubinin, checkstyle-devel
Hi Timur,

this project is the most complicated among all that we have.
After switch from antlr2 to antlr4, there should be minimal amount of bracking compatibilities in AST structure.
As all Checks expect strict AST , if at least something is changed - Check will not work.

It will require to create java parser (grammar) from scratch. There are already example of Antlr grammar for java in antlr project.
It might be good point to start .....
But we have to keep compatibility with old AST as all Checks rely on it enormously (there might be special transformer of AST to old structure is required, or ............... ).
Reply all
Reply to author
Forward
0 new messages