For many languages there are mature parsers out there that can be reused (e.g. Google's Closure compiler or babel for JavaScript, or the Soot framework for Java that also simplifies more advanced code analysis). In the worst case, it's sometimes possible to interface with the standard compiler for the language directly (for example, the TypeScript compiler provides TypeScript APIs for its parser/type checker/etc.). I believe for C++ for example, a Clang plugin (https://clang.llvm.org/docs/ClangPlugins.html) would have been a plausible way to implement something like this.