Abstract
In a number of tasks the need for a macro preprocessor arises. Most macro preprocessors, are either syntactically tied to the language they support (e.g., cpp, the C preprocessor, or the lisp macro facility), or they are limited in their functionality (cpp), or may even have an arcane syntax (e.g. m4, chakotay).We propose a macro preprocessor - PYM - based on the Python scripting language, which retains the complete expressivity of Python for writing macros, and thus is not limited by an arcane syntax or a limitation in its functionality. The complete implementation of this macro preprocessor is a Python script of around 200 lines of code, and includes the three main functions of macro definition, macro expansion, and file inclusion. Using Python's exception mechanism, conditional termination of expansion both on a per file, and overall level has been implemented. PYM has been shown to be useful for macro based generation of VRML files, and for macro based generation of HTML files for a dynamic web server.
Users
Please
log in to take part in the discussion (add own reviews or comments).