Preprocessing

From Compiler writing

Jump to: navigation, search

Preprocessing is the name given to a variety of operations including defining/substituting macros, conditional compilation and include file processing.

Preprocessing is a phase that usually occurs after lexing and before parsing, i.e., most preprocessors are token based rather than character based (e.g., C and C++).

Most preprocessing languages can be handled by performing lexical analysis and maintaining a symbol table/stack holding information on previously seen macros and conditional compilation directives.

If you have chosen a target language that includes a preprocessor you will need to do some handling of preprocessing directives, if only to ignore them.

Preprocessor languages are usually very primitive and the current plan is to ignore them. If you need to preprocess your source then try and obtain one that has already been written.

If your target language is a preprocessor, then I hope the syntax and semantics are complicated enough to make it worthwhile studying.

Software

Links

Personal tools