What’s antlr? Useful for?
Hi! antlr is a tool for generating parsers. It supports generating Swift code, but Swift itself doesn't use it anywhere I'm aware of.
See also https://www.antlr.org
Recently, I used Antlr to generate a Swift parser, parsing Java code (with a modified lexer that ignores comments from the code). Then I used the parser in my Swift/SwiftUI app to check that certain Java methods use (or do not use) certain features.
The app is used to analyze student submissions of Java programming tasks. Like if students are supposed to implement a recursive binary search algorithm, the code must not contain while
or for
loops and/or the method calls itself.