Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!usc!samsung!uunet!microsoft!jimad From: jimad@microsoft.UUCP (Jim ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: C++ Grammar Message-ID: <70872@microsoft.UUCP> Date: 25 Feb 91 18:56:56 GMT References: <3786@lupine.NCD.COM> <1991Feb08.130548.6878@iti.com> <70609@microsoft.UUCP> <112@shasta.Stanford.EDU> Reply-To: jimad@microsoft.UUCP (Jim ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 20 In article <112@shasta.Stanford.EDU> shap@shasta.Stanford.EDU (shap) writes: |The problem with Roskind's grammar (at least the last time I looked - it |may have been updated in the past few months) is that it requires the |lexer to resolve "typedef" v/s "identifier", which is probably the most |difficult problem in the language as far as parsing goes. If anyone has |built a tool that overcomes this limitation, including the associated |symtab support, I would be interested to see it. Huh? As far as I can see, the need for the lexer feedback hack is central to any C/C++ parser using a lex/yacc like approach. The need for the hack is implicit in the C/C++ language's permission of allowing typedef to define new types, that then can be used in the future without a "struct", "class", "union", or "type" keyword as one would find in other languages that allows differentiation the typedef word from identifiers. I don't see this as a restriction in Roskind's approach. I see it as a central requirement of C/C++ parsing because of "typedefs." All lex/yacc - like approaches that I have seen use this hack. How else would you do it?