18.1 Introduction. 4tH 4tH Forth compiler
Reklama
Reklama
Chapter 18
Preprocessor manual
18.1
Introduction
The preprocessor is a tool written in 4tH that has the following features:
• It expands special macro definitions. These macro definitions can contain anything you want;
• It strips whitespace and comments;
• It collects all include files and inserts them into the source;
• It expands [CHAR] and CHAR constructs.
This tool can help you to solve several problems:
• Your 4tH implementation has serious memory restrictions, so certain sources cannot be compiled;
• You have to port Forth programs that use complex jump constructs.
• You have to write Forth compatible programs without the use of easy.4th;
• You can simplify development by writing complex programs more easily;
• You need to inline code in a structured way;
• It may serve in some situations as a debugging tool.
Note that the preprocessor is just a tool to automate certain sourcecode manipulations.
It doesn’t compile anything, although it does perform some syntax checks
1
. Succesfully processed source can be rejected by the compiler for any number of reasons.
Every valid 4tH program is automatically valid 4tH preprocessor source. In addition the preprocessor supports special preprocessor words, which are listed below.
1
The preprocessor is sometimes even more pedantic than 4tH itself, see section 18.7.
359
Preuzimanje
Reklama