Ian Lance Taylor <[EMAIL PROTECTED]> writes:

| "Simon Brenner" <[EMAIL PROTECTED]> writes:
| 
| > I propose to implement incremental parsing in C++ (through hand-waving, C++ 
has
| > been decided to be the language most in need of incremental parsing), 
similar to
| > the approach in article [1]. Basically, a diff algorithm is run on the 
character
| > or token stream, producing a list of insertions, modifications, and 
deletions,
| > and this list of changed characters/tokens is compared to the previous parse
| > tree to decide what parts of the tree need reparsing and recompilation.
| > 
| > In this project, I wouldn't even try to attack incremental code generation, 
but
| > just run the entire middle/back end on an updated tree. A future extension
| > would be to use the information about which trees have changed to perform
| > minimal code generation. This approach obviously limits the improvement in
| > compile time, and an important initial part of the project would be to 
measure
| > the time spent in lexing, parsing and everything after parsing to see what 
the
| > potential gain would be.
| 
| Another approach I've considered is to skip parsing functions until
| they are needed.  Since the parser dominates the -O0 compilation time,
| and since large C++ projects have hundreds of inline functions which
| are never needed by any particular compilation, I think there could be
| a big -O0 benefit from only parsing functions as needed.

That defered parsing might work with C (I don't really know), but it
certainly is problematic with C++ because there are bindings that
need to be in overload sets, and you cannot accurately capture those if
you don't parse the function bodies.  Sadly.

Of course, if you know in advance that your programs don't fall in
that category (run the compiler twice), then you can use the deferred
parsing strategy.

-- Gaby

Reply via email to