Dart2 static analyser

102 views
Skip to first unread message

Ivan Rendulic

unread,
Apr 25, 2022, 2:59:17 PM4/25/22
to antlr-discussion
Is there an updated grammar (Dart.g4) for latest Dart language specification?
I found one but is using java inside *.g file. I can not compile it with antlr4.dart
I tried to convert, but I am not fluent in Java.


Ken Domino

unread,
Apr 26, 2022, 12:20:21 AM4/26/22
to antlr-discussion
I ported the semi-official Dart grammar (https://github.com/dart-lang/sdk/blob/main/tools/spec_parser/Dart.g) to a so-called "target-agnostic format" and included Dart base classes here: https://github.com/kaby76/DartGrammar. In order for the grammar to work for both Dart and Java, the action code was moved into methods within the recognizer base classes, and replaced with method calls. NB: the language spec for Dart may be out of sync with this grammar.

Ivan Rendulic

unread,
Apr 26, 2022, 1:32:43 AM4/26/22
to antlr-discussion
Well, it works very well. I have tested on some projects.
It is much faster than the official dart analyser package.
:-)

Reply all
Reply to author
Forward
0 new messages