From: <se...@in...> - 2006-07-25 14:04:08
|
On Mon, 2006-07-24 at 14:53 -0400, Stefan Seefeld wrote: > skaller wrote: > > On Mon, 2006-07-24 at 14:14 -0400, Stefan Seefeld wrote: > >> skaller wrote: > > [...] > > In other words it generates an actual parse tree, rather than > > an abstract syntax tree? the "rather" may mislead, the parse tree is an augmented AST. And further more, for C++, abstract syntax tree(AST) is kind of wrong. That is, as pointed out by stefan below, that the resulting AST received from a particular translation unit, can not be is representation without semantic analysis. Abstract semantic tree anyone. Let say also, that grammar for openc++ need a major refresh. I means, it is not the same as the one given in appendix A of the ISO standard. So it cost you more for changing or applying desired behaviors. > Exactly. OpenC++ generates a parse tree, and does everything else in a secondary > pass. However, it doesn't preserve alternatives resulting from ambiguous syntax, > but rather uses some heuristics to 'guess' the right interpretation of the syntax... > which may fail. > > Synopsis on the other hand does construct a symbol table during parsing, and thus > can disambiguate on-the-fly (much like g++ actually). > The result is still a parse tree (using a cleaned up and enhanced version of OpenC++'s > own PTree design), and all higher level representations (such as AST) are then built > by traversing the parse tree, symbol table, and type repository (once completed). > > Regards, > Stefan > |