readme - CheaderParsing

readme - CheaderParsing



Why CheaderParsing is used:

Headerfiles of the C or C++ programming language contain structural informations about data and maybe about calling possibilities (function prototypes, methods).

The data structures may be able to use in other contexts, at example:

The usage of that possibilities is shown in other examples of ZBNF too. This example is proper only for a simple test of the parser and the Header syntax.

The syntax of a header file:

It is contained in the file zbnfjax/zbnf/Cheader.zbnf. The syntax is checked with some headerfiles in praxis, but it may be considered not all variants yet.

There is a principal problem: A C-or C++-compiler runs at first the preprocessor, which includes some other files, regards conditional compiling and replaces macros with its defined values. This is a formal textual process, not a parsing process. That result is read from the compiler to parse. The here used ZBNF-parser takes the content of the header file immediately without preprocessing.

In the practice there were less problems with a lot of variants of headerfiles, at example generated from an UML-tool. But, if a user writes a complexly content, which uses special defines, a parsing process isn't able. Than a preprocessor of a C/C++-compiler should prepare the headerfile before parsing.

At the other hand the comment may contain some informations:

The ZBNF-Parser is able to read informations from commentation. If a preprocessor runs, the comment is removed mostly. Therefore it isn't practical to use a standard preprocessor. But a special preprocessor, which preserves the comments, may be proper to use.

The example contains:


If testCheader.bat is invoked, the following files should be created: