Wanted: Scanner for C/C++

Art Pollard <Pollarda@Lextek.com>
27 Dec 1998 01:08:27 -0500

          From comp.compilers

Related articles
Wanted: Scanner for C/C++ Pollarda@Lextek.com (Art Pollard) (1998-12-27)
| List of all articles for this month |

From: Art Pollard <Pollarda@Lextek.com>
Newsgroups: comp.compilers
Date: 27 Dec 1998 01:08:27 -0500
Organization: Burgoyne Computers Inc.
Keywords: C, C++, lex, question, comment


I am looking for a lex scanner for C/C++. What makes my needs unique is
that I need to be able to identify the various parts of the language
without resorting to a parser.

I would like to be able to idenfify such things as:

Function Calls
Function Declarations
Variable Names
Comments, etc.

This is for a tool which indexes source code. (I believe there is one
for Unix but I can't seem to find out what it is called.) I tried
writing one using Flex which can identify the various parts of the
source file but Flex choked on the trailing contexts.

Any help / assistance would be greatly appreciated.


[I believe your choices boil down to ad-hoc pattern matching with the
occasional wrong guess, or parse the whole thing and throw away the
parse results. I'd parse, by the time you tokenize the extra cost of
parsing is insignificant. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.