I remember Gentoo once started a project to parse Bash scripts in C - libbash. For some reasons it was abandoned, but maybe can be reused in such a rewrite:
You might even go further and convert the bash/zsh sources from C to Rust using amazing c2rust automated converter and refactoring tool.

Wish you luck, that would be an amazing project!
Originally posted by @XVilka in koalaman/shellcheck#809 (comment)