1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title>Preface</title> |
---|
5 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
6 | <link href="theme/style.css" rel="stylesheet" type="text/css"> |
---|
7 | </head> |
---|
8 | |
---|
9 | <body text="#000000" background="theme/bkd.gif"> |
---|
10 | <table width="100%" border="0" cellspacing="2" background="theme/bkd2.gif"> |
---|
11 | <tr> |
---|
12 | <td width="21"> <h1></h1></td> |
---|
13 | <td width="885"> <font face="Verdana, Arial, Helvetica, sans-serif"><b><font size="6">Preface</font></b></font></td> |
---|
14 | <td width="96"><a href="http://www.boost.org"><img src="theme/wave.gif" width="93" height="68" align="right" border="0"></a></td> |
---|
15 | </tr> |
---|
16 | </table> |
---|
17 | <br> |
---|
18 | <table border="0"> |
---|
19 | <tr> |
---|
20 | <td width="10"></td> |
---|
21 | <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> |
---|
22 | <td width="30"><img src="theme/l_arr_disabled.gif" width="20" height="19" border="0"></td> |
---|
23 | <td width="30"><a href="introduction.html"><img src="theme/r_arr.gif" border="0"></a></td> |
---|
24 | </tr> |
---|
25 | </table> |
---|
26 | <p>During the last time many new features were developed as additions to the <tt>Spirit</tt> |
---|
27 | <a href="references.html#spirit">[4]</a> parser construction framework and we |
---|
28 | felt more and more, that it would be very helpful, to have a 'real world' example, |
---|
29 | which could be used as a sandbox for testing the usability of certain features. |
---|
30 | Additionally a recent discussion on the Boost mailing list showed the widespread |
---|
31 | interest of developers to have a modern, open source C++ preprocessor library |
---|
32 | to play with. So we had the idea to implement a C++ preprocessor to fit |
---|
33 | this needs - <tt>Wave</tt> was born.</p> |
---|
34 | <p align="justify">The <tt>Wave</tt> C++ preprocessor library uses the <a href="http://www.boost.org/"> |
---|
35 | </a> <tt>Spirit<a href="references.html#spirit">[4]</a></tt> parser construction |
---|
36 | library to implement a C++ lexer with ISO/ANSI Standards conformant preprocessing |
---|
37 | capabilities. It exposes an iterator interface, which returns the current preprocessed |
---|
38 | token from the input stream. This preprocessed token is generated on the fly |
---|
39 | while iterating over the preprocessor iterator sequence (in the terminology |
---|
40 | of the STL these iterators are forward iterators). </p> |
---|
41 | <p align="justify"> The C++ preprocessor is a macro processor that under normal |
---|
42 | circumstances is used automatically by your C++ compiler to transform your program |
---|
43 | before actual compilation. It is called a macro processor because it allows |
---|
44 | you to define macros, which are brief abbreviations for longer constructs. The |
---|
45 | C++ preprocessor provides four separate facilities that you can use as you see |
---|
46 | fit: </p> |
---|
47 | <blockquote> |
---|
48 | <p><b><img src="theme/bullet.gif" width="13" height="13" id="IMG1"> </b>Inclusion |
---|
49 | of header files<br> |
---|
50 | <b><img src="theme/bullet.gif" width="13" height="13" id="IMG1"> </b>Macro |
---|
51 | expansion<br> |
---|
52 | <b><img src="theme/bullet.gif" width="13" height="13" id="IMG1"> </b>Conditional |
---|
53 | compilation<br> |
---|
54 | <b><img src="theme/bullet.gif" width="13" height="13" id="IMG1"> </b>Line |
---|
55 | control</p> |
---|
56 | </blockquote> |
---|
57 | <p>These features are greatly underestimated today, even more, the preprocessor |
---|
58 | has been frowned on for so long that its usage just hasn't been effectively |
---|
59 | pushed until the Boost preprocessor library <a href="references.html#pp_lib">[7]</a> |
---|
60 | came into being a few years ago. Only today we begin to understand, that preprocessor |
---|
61 | generative metaprogramming combined with template metaprogramming in C++ is |
---|
62 | by far one of the most powerful compile-time reflection/metaprogramming facilities |
---|
63 | that any language has ever supported.</p> |
---|
64 | <p>The C++ Standard <a href="http://webstore.ansi.org/ansidocstore/product.asp?sku=INCITS%2FISO%2FIEC%2B14882%2D1998">[2] </a> was adopted back in 1998, but there is still no (known to me) C++ compiler, which has a bugfree implementation of the rather simple preprocessor requirements mandated therein. This may be a result of the mentioned underestimation or even banning of the preprocessor from good programming style during the last few years or may stem from the somewhat awkward standardese dialect of English used to describe it. </p> |
---|
65 | <p align="justify">So the main goals for the <tt>Wave</tt> project are:</p> |
---|
66 | <blockquote> |
---|
67 | <p><b><img src="theme/bullet.gif" width="13" height="13" id="IMG1"> </b>full |
---|
68 | conformance with the C++ standard (ISO/IEC 14882:1998) <a href="references.html#iso_cpp">[1]</a> |
---|
69 | and with the C99 standard (INCITS/ISO/IEC 9899:1999) <a href="references.html#iso_c">[2]</a><br> |
---|
70 | <b><img src="theme/bullet.gif" width="13" height="13"> </b>usage of <tt>Spirit<a href="references.html#spirit">[4]</a></tt> |
---|
71 | for the parsing parts of the game (certainly :-)<br> |
---|
72 | <b><img src="theme/bullet.gif" width="13" height="13"> </b>maximal usage |
---|
73 | of STL and/or <tt>Boost</tt> libraries (for compactness and maintainability)<br> |
---|
74 | <b><img src="theme/bullet.gif" width="13" height="13"> </b>straightforward |
---|
75 | extendability for the implementation of additional features<br> |
---|
76 | <b><img src="theme/bullet.gif" width="13" height="13"> </b>building a |
---|
77 | flexible library for different C++ lexing and preprocessing needs</p> |
---|
78 | </blockquote> |
---|
79 | <p>At the first steps it is not planned to make a very high performance or very |
---|
80 | small C++ preprocessor. If you are looking for these objectives you probably |
---|
81 | have to look at other places. Although our C++ preprocessor iterator works as expected and is usable as a reference implementation, for instance |
---|
82 | for testing of other preprocessor oriented libraries as the Boost Preprocessor |
---|
83 | library <a href="references.html#pp_lib">[7]</a> et.al. Nevertheless recent work has lead to surprising performance enhancements (if compared |
---|
84 | with earlier versions). Wave is still somewhat slower as for instance EDG |
---|
85 | based preprocessors (Intel, Comeau) on simple input files, however, as |
---|
86 | complexity increases, time dilates expontentially on EDG. Preprocessing time |
---|
87 | dilates linearly under Wave, which causes it to easily outperform EDG based |
---|
88 | preprocessors when complexity increases.</p> |
---|
89 | <p>As tests showed, the <tt>Wave</tt> library is very conformant to the C++ Standard, |
---|
90 | such that it compiles several strict conformant macro definitions, which are |
---|
91 | not even compilable with EDG based preprocessors (i.e. Comeau or Intel). The only preprocessor known to have similar Standards conformance |
---|
92 | today is the preprocessor of the gcc C/C++ compiler.</p> |
---|
93 | <table border="0"> |
---|
94 | <tr> |
---|
95 | <td width="10"></td> |
---|
96 | <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> |
---|
97 | <td width="30"><img src="theme/l_arr_disabled.gif" width="20" height="19" border="0"></td> |
---|
98 | <td width="30"><a href="introduction.html"><img src="theme/r_arr.gif" border="0"></a></td> |
---|
99 | </tr> |
---|
100 | </table> |
---|
101 | <hr size="1"> |
---|
102 | <p class="copyright">Copyright © 2003-2007 Hartmut Kaiser<br> |
---|
103 | <br> |
---|
104 | <font size="2">Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) </font> </p> |
---|
105 | <span class="updated"></span> |
---|
106 | <p class="copyright"><span class="updated">Last updated: |
---|
107 | <!-- #BeginDate format:fcAm1m -->Sunday, May 15, 2005 12:23<!-- #EndDate --> |
---|
108 | </span></p> |
---|
109 | </body> |
---|
110 | </html> |
---|