The main Yacc is in
https://github.com/harbour/core/blob/master/src/compiler/harbour.y , personally I did not study it, so I don't know if it is useful for your purpose.
On VSCode, My extension lints the code calling harbour executable with -s (syntax check only), -m (compile module only) and -n0 (no implicit starting procedure) options, then parse the output.