it is much easier to implement parsers in Swift than it is in C++.
are there any fundamental reasons why the lib/parse module could not be implemented in Swift? having an up-to-date AST parser as a normal Swift package would be immensely useful for tooling written in Swift.
Could it be? Of course, the upcoming Swift 5.6 compiler is the first to link against the Swift standard library, a result of @Erik_Eckstein's ongoing libswift effort which you can read about here:
> readelf -d swift-5.6-DEVELOPMENT-SNAPSHOT-2022-01-11-a-centos8/usr/bin/swift | ag swift
0x0000000000000001 (NEEDED) Shared library: [libswiftCore.so]
0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN/../lib/swift/linux]
It seems to mostly consist of Swift wrappers around optimization passes written in C++ right now. I know it was enabled because I had to patch it to build for my native Swift toolchain for Android, so I could get the first Swift 5.6 snapshot from last week running (a working Android AArch64 Swift 5.6 toolchain for the Termux app is available as a github Action CI artifact).
Will it be? The tokei code count program reports 18.3 klocs of C++ in
lib/Parse, it all depends on if someone sees fit to rewrite that in Swift.