[fpc-pascal] Access to compiler's internal data structures

Michael Van Canneyt michael at freepascal.org
Sat Sep 1 12:00:21 CEST 2012

On Fri, 31 Aug 2012, Kenneth Cochran wrote:

> First I'll say I know very little about the inner workings of an actual compiler. I took a course on formal language theory ages ago so I do have some
> understanding of the theory. Lately my interests have been pulling me toward projects that either benefit from or depend on static analysis. So I'm finding
> myself in need of a parser for object pascal. I'm wondering if fpc exposes any of the output (syntax trees, graphs, etc) from the parser that could be consumed
> by an external tool?

Fpc's fcl-passrc package gives you a parser that produces an abstract syntax tree of the units that have been parsed.
(pparser, pastree units)

There are people that use this to analyse their code. It is used to create webservices from existing interfaces.
The documentation is produced from the abstract syntax tree.

Maybe it is useful for your purposes as well.


More information about the fpc-pascal mailing list