C++ symbol table

Joydip Dass <jdass@cssc-melb.tansu.com.au>
Fri, 19 Feb 1993 02:05:54 GMT

          From comp.compilers

Related articles
C++ symbol table jdass@cssc-melb.tansu.com.au (Joydip Dass) (1993-02-19)
Re: C++ symbol table preston@dawn.cs.rice.edu (1993-02-19)
Re: C++ symbol table chased@rbbb.Eng.Sun.COM (1993-02-19)
Re: C++ symbol table tony@cs.colorado.edu (1993-02-21)
Re: C++ symbol table dietz@cs.rochester.edu (1993-02-23)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Joydip Dass <jdass@cssc-melb.tansu.com.au>
Keywords: C++, parse, question, comment
Organization: Compilers Central
Date: Fri, 19 Feb 1993 02:05:54 GMT


I am currently trying to do some work on parsing some C++ code. I am new
at this stuff so pardon my ignorance....

I have got hold of Jim Roskind`s C++ grammar. I have also modified his
Flex input file to suit my purposes. However, as he points out in his
documentation, the lexer he supplied does not include a SYMBOL TABLE and
does NOT KEEP TRACK OF CURRENT SCOPES. I am in need of these

My objectives are -
- To keep a list of all identifiers in the C++ code being parsed.
(Identifiers include - variables, #defines, and function names etc.)

- I want to be able to identify these things separately i.e. distinguish a
function name from a variable. I also want to be able to tell different
types of variables apart e.g. a pointer declaration from a non-pointer
variable OR an int declaration from a register declaration.
- I would like to store these in some sort of a hash table to do the
fastest possible searches.

This sounds a bit vague at the moment, but if I can achieve these
particular objectives I will be better equipped to plan future directions.

I have read the bit on symbol tables in "lex & yacc" by Levine, Mason and
Brown. It was most helpful in understanding the basic concepts of symbol
tabels etc. However, if anyone out there has already worked on this
problem I would like to get hold of it. I think what I am trying to do is
more complex than the examples in the book and any help would save me a
lot of time.

Many Thanks in advance to anyone who can help me.

Joydip Das
[Maybe you could extract what you need from g++. -John]

Post a followup to this message

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