Preprocessor
A preprocessor for C.
We provide a preprocessor for C that, unlike typical preprocessors,
preserves the information about the #include directives.
That is, it does not replace such directives
with the (preprocessed) contents of the referenced files,
but it otherwise performs the rest of the preprocessing.
Our preprocessor maps a list of file paths
to a file set (see files):
it preprocesses all the files with the given file paths,
as well as all the files directly and indirectly included.
The resulting file set contains entries for all such files,
not only the ones with the given file paths.
Our preprocessor reads characters and lexes them into lexemes,
while executing the preprocessing directives.
The resulting sequence of lexemes is then turned into characters
that are written into files.
The resulting file set is amenable to our parser
(more precisely, it will be, once we have extended our parser
to accept #include directives in certain places).
Our preprocessor preserves white space, in order to preserve the layout
(modulo the inherent layout changes caused by preprocessing).
Our preprocessor also preserves comments,
although some comments may no longer apply to preprocessed code
(e.g. comments talking about macros).
Currently some of this preprocessor's code duplicates, at some level,
some of the code in the parser
(including the lexer and the reader).
At some point we should integrate the preprocessor with the parser.
This preprocessor is still work in progress.
Subtopics
- Pproc
- Preprocess files.
- Preprocessor-states
- States of the preprocessor.
- Preprocessor-printer
- Printer component of the preprocessor.
- Pread-token/newline
- Read a token or newline during preprocessing.
- Pread-token
- Read a token during preprocessing.
- Pproc-files
- Preprocess zero or more files.
- Preprocessor-lexer
- Lexer component of the preprocessor.
- Pproc-file
- Preprocess a file.
- Pproc-group-part
- Preprocess a group part.
- Pproc-*-group-part
- Preprocess zero or more group parts.
- Pproc-directive
- Preprocess a directive.
- *pproc-files-max*
- Maximum number of files being preprocessed.
- String-plexeme-list-alist-to-filepath-filedata-map
- Turn (1) an alist from string to lists of preprocessing lexemes
into (2) a map from file paths to file data.
- String-plexeme-list-alist
- Fixtype of alists from strings to lists of preprocessing lexemes.
- Read-input-file-to-preproc
- Read a file to preprocess, explicitly specified as user input.
- Preprocessor-reader
- Reader component of the preprocessor.
- Preprocessor-messages
- Messages from he preprocessor (including lexer and reader).