help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Flex - Windows ("flex scanner push-back overflow" work around)


From: Hans-Bernhard Broeker
Subject: Re: Flex - Windows ("flex scanner push-back overflow" work around)
Date: Sun, 14 Mar 2004 13:39:14 +0100 (CET)

On Thu, 11 Mar 2004, Dan Chalk wrote:

> any comment you had on it (if you get a second).  My project is orientated
> around producing a C++ code sample critquer to allow the first years on my
[...]
> and as a result I'm getting the "flex scanner push-back overflow" error

You're trying to do the job with the wrong tool, more particularly with an
incomplete set of tools.  Flex on its own is quite certainly uncapable of
parsing even C syntax completely, let alone the much more complex C++.  
For C++, it's been argued that even the full usual team of lex+yacc (or
flex+bison) is insufficient.  Bjarne himself went on record stating that
one of his worst design mistakes made in his own C++ compilers was to ever
try parsing C++ with yacc.

The usual problems involve multi-token look-ahead and the fact that
regexps cannot possibly recognize arbitrary numbers of nested parentheses.

I'm the maintainer of a C scanner built using only flex (cscope), and that
one fails quite spectacularly for, e.g. function pointers.  I don't even
want to *think* of what would happen if I were to try and add parsing of
C++ templates to that.

-- 
Hans-Bernhard Broeker (address@hidden)
Even if all the snow were burnt, ashes would remain.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]