From: Stefan S. <se...@sy...> - 2004-08-10 03:35:39
|
Grzegorz Jakacki wrote: > Hi, > > I checked in my attempt at reverse-engineering docs of OpenC++ > architecture on the class level. The document is incomplete and most > likely in flux, since architecture is changing now, but at least it > describes status quo. Please review, fix, give feedback. > > The docs are in opencxx/doc/architecture.html wouldn't it be a good idea to publish these documents on the website ? I'm working my way through the code as I'm cleaning up the 'synopsis branch'. Also, our latest discussions with Chiba have helped me a lot to understand the current approach... Something that has to be discussed quite in detail for anybody to understand the design of the parser (notably the Walker stuff) is the two-stage parsing that is done, i.e. the Parser building up a preliminary parse tree and then the Walker running over it creating the various 'Environments'. (Up to our discussion a while ago I just couldn't figure out why the Walker modified the ptree it was traversing. Now I see and understand that it needs to to fill in the things the parser's first pass couldn't figure out yet.) A simple example would help to illustrate this: ----- struct Foo {}; void bar(const Foo &); ----- creating a parse / syntax tree for this using occ is done in two steps: * the first builds a preliminary ptree via Lexer -> Parser * the second refines the ptree using the Walker to build an 'Environment' containing the declaration of 'Foo', which is needed to properly encode the name/type of 'bar' (in the first pass the parser has to *guess* some details about the function arguments, as no Environment object is available for it to inspect). I hope this makes some sense... Now, I believe it would be important to try to move this to a one-step parse, i.e. integrate the Environment building into the parser such that the parser can correctly deal with corner cases that used to be interpreted incorrectly. Regards, Stefan |