Re: Recognition of typedefs in C ?

Anthony PIRON <apiron@ulb.ac.be>
19 Jan 2001 23:27:27 -0500

          From comp.compilers

Related articles
Recognition of typedefs in C ? davidpereira@home.com (David Pereira) (2001-01-18)
Re: Recognition of typedefs in C ? henry@spsystems.net (2001-01-19)
Re: Recognition of typedefs in C ? apiron@ulb.ac.be (Anthony PIRON) (2001-01-19)
Re: Recognition of typedefs in C ? Joachim.Pimiskern@de.bosch.com (Joachim Pimiskern) (2001-01-19)
Re: Recognition of typedefs in C ? jos@and.nl (Jos A. Horsmeier) (2001-01-26)
| List of all articles for this month |
From: Anthony PIRON <apiron@ulb.ac.be>
Newsgroups: comp.compilers
Date: 19 Jan 2001 23:27:27 -0500
Organization: VUB/ULB Computing Centre
References: 01-01-096
Keywords: C, parse
Posted-Date: 19 Jan 2001 23:27:27 EST

hi,


  The better will probably be to move this recognition to the parsing
phase. The context concerns are typical things of the parser work -
nevertheless the extensions of lex can help to make some parts of the
work: with states and others concepts.
  A hierachical symbol table (in C: a tree rooted by a global table
followed by a local table for each function and next the block
structure) can do the work fine by saving the type of the identifiers.




Best regards.


David Pereira wrote:


> I need to enable the lexer to distinguish
> typedef names from ordinary identifiers. At first glance, it seemed
> that building a table of typedef names was enough - the lexer would
> consult this table and return TYPENAME if the name was found in this
> table, otherwise IDENTIFIER. However, this is inadequate since
> *context* matters. How can this context be discerned ?


--
Anthony PIRON - Researcher
Universite Libre de Bruxelles, Department of Computer Science
CP 212 - Boulevard du Triomphe, B-1050 Bruxelles, Belgium
Tel. +32 2 650 50 55, Fax +32 2 650 56 09, GSM +32 478 530 022
Email: apiron@ulb.ac.be Web: http://www.ulb.ac.be/di/ssd/apiron


Post a followup to this message

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