Converting a portable Pascal p‐code interpreter to a code generator

Victor B. Schneider · Software Practice and Experience · 1989

Abstract This is a technical note that assumes reader familiarity with Pagan's paper on converting scaled down Pascal p‐code programming language interpreters into simple compilers.1 This note discusses the extension of Pagan's methods to a full‐scale Pascal‐to‐C translator. In order to make procedure calls and typed function calls work properly for such a translator, it was found necessary to add type information to one of the p‐code calling instructions (and alter the Pascal‐to‐p‐code translator accordingly). A table of execution times for Pagan's ‘50 primes’ bench‐mark program shows the improvements obtained as a result of successive refinements in the Pascal‐to‐C translator, until the present version that uses C ‘register variables’ for integer arithmetic.2 Programs compiled using this system can also be linked into C programs as functions or procedures and can be debugged using standard C debuggers.

Read the paper · More papers on PaperTik