Hacker News new | ask | show | jobs
by tgv 1146 days ago
Yes, but there is decent support for code generation. E.g., you can easily get the syntax tree of a go program.
1 comments

Maybe the tools aren't there but there's no reason you couldn't parse Pascal the same way. It's not a complicated language.
FWIW Free Pascal's FCL has the fcl-passrc package that provides units for scanning FPC code, building syntax trees, resolving identifier references and writing/formatting source code.

Free Pascal comes with pas2js which "transpiles" Free Pascal code to Java Script and is written using fcl-passrc so it should have enough functionality to parse most FPC code.

Go neither, but parsing and AST are in the standard library, and code generation is in the standard build process. All it requires is an (ugly) comment line in your source code. So you've got decent and standard tooling. No make magic required.