Re: FWD:Re: refactoring

Stefan Seefeld <[email protected]>
Newsgroups gmane.comp.documentation.synopsis
Message-ID <[email protected]>
Joel de Guzman wrote:

> Hartmut Kaiser noted that Stefan intends to use the Wave C/C++
> preprocessor. Wave started out as a challenge I posed that Hartmut
> took seriously. Hartmut, with lots of help and advice from Paul
> Mensonides (the CPP guru), got it going strong.

Indeed, I'v been working a bit on integrating a wave backend into
synopsis. As I indicated on the boost ML I'm running wave in an
emulation mode where I extract various flags from installed compilers
and then run wave with them. Using this technique I processed
boost itself, which exposed a couple of bugs.
As soon as these are all fixed, and wave is formally released
(i.e. with the boost 1.33 presumably) synopsis can officially
support wave as its Cpp backend.

> Prior to Wave,
> there were plans for a Spirit based C++ parser. In fact, there
> were some early attempts, but were not quite there yet partly due

> to lack of a good preprocessor. With a good lexing preprocessor,
> the next logical step is the C++ parser. I'd be thrilled in any
> collaboration.

At the heart of synopsis are a number of 'IR's the different
parsers generate, such as a parse tree, a symbol lookup table,
and an AST.
While these are all subject to enhancement / refinement, I believe
that parsers should support them. For example, the parse tree
representation preserves some of the comments from the source file,
which later can be used as metadata (useful for document extraction
akin to doxygen, or as processing instructions for code generation).
Similarly, the parse tree nodes don't store tokens, but instead refer
to positions in a buffer. This allows users to manipulate the parse
tree and regenerate the source code in a minimally-intrusive way.

Having said that, it would be terrific to add and enhance parsers
and analysis tools that help to make these representations useful.

It would for example be of great value to have a C++ parser
that would - similar to wave - trace the processing of source code
and thus help users better understand their code and C++ in general.
Gone are the days of huge incomprehensible error messages when using
template-heavy code. :-)

Regards,
		Stefan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.