pascodegen is a unit with a class that can be used to generate pascal code.
it offers the
TPascalCodeGenerator class which has some utility methods for
indenting code, offers logging and automatic handling of code sections or blocks
(variable, constant etc.) The resulting code is available in a stringlist.