My idea of a pascal compiler is, to either convert it proceduraly, such as with a tokenizer and a syntax pre"compiler" (which would check for people doing c/c++ tricks and fix such stuff with proper code), and convert the code as it sees it, it would just read it, each procedure by procedure and definition by definition in precompiling part, then create a pascal unit, properly handling defines, processing procedure declarations and comments.

That would work best for C, for c++ it would get a little more sophisticated.

Ofcourse, one could as well take GCC and create a "pascal cpu" port for it