type or identifier fundamental parsing issue - Need help from parsing experts

AD <hsad005@gmail.com>
Tue, 3 Jul 2012 11:30:48 -0700 (PDT)

          From comp.compilers

Related articles
type or identifier fundamental parsing issue - Need help from parsing hsad005@gmail.com (AD) (2012-07-03)
Re: type or identifier fundamental parsing issue - Need help from pars gneuner2@comcast.net (George Neuner) (2012-07-04)
Re: type or identifier fundamental parsing issue - Need help from pars DrDiettrich1@aol.com (Hans-Peter Diettrich) (2012-07-04)
Re: type or identifier fundamental parsing issue - Need help from pars torbenm@diku.dk (2012-07-11)
Re: C arcana, was type or identifier fundamental parsing issue - Need christian.bau@cbau.wanadoo.co.uk (christian.bau) (2012-07-12)
| List of all articles for this month |
DKIM-Signature: v=1; a=rsa-sha256; c=simple; d=iecc.com; h=cc:from:subject:date:sender:message-id:mime-version:content-type:content-transfer-encoding:vbr-info; s=1857f.4ff3ab3d.k1207; i=johnl@user.iecc.com; bh=Qu9c50CjGMWPrARBy+zRL0o7GRDh/0Yn4yLxBZYKZgU=; b=RNyZWH+90Iy6f5UVAGVYF7H8/beTAv2IUsk5jZlrFAhU9jT0Rm2qMzwR7JgWID2GwF9ZoymbO2W7cnEzZJZfC3Zqvy16Ib2pjoneolN52XHfj54eupSI2PNZ8y6nhUH38lZz7e0hMU5/LExtrbJV+iX/j8ScoHG3NDQ1hsUhd+o=
VBR-Info: md=iecc.com; mc=all; mv=dwl.spamhaus.org
From: AD <hsad005@gmail.com>
Newsgroups: comp.compilers
Date: Tue, 3 Jul 2012 11:30:48 -0700 (PDT)
Organization: Compilers Central
Keywords: parse, types, design, question
Posted-Date: 03 Jul 2012 22:32:28 EDT

Greetings All,


I am dealing with a programming langauge that supports something like
sizeof(<typename>) as well as sizeof(<variable-name>) expression.


For parsing such a construct, one would need a parser/yacc rule somewhat like
the following:


SIZEOF_KEYWORD '(' IDENTIFIER ')'


The fundamemtal problem in the rules of the language (that I am dealing with)
is that its lookup/resolution rule *doesn't* allow me to check in symbol table
if that 'IDENTIFIER' is a type or non-type variable. Problem is, this language
supports certain constructs which can potentially/later make such early
lookup/resolution decisions wrong. In short, name resolutions in this langauge
(as per the langauge definition) can only be initiated after the entire source
code has been completely parsed/seen.


Given this restriction, I will probably have to delay/defer the decision of,
whether we saw a 'type' or a non-type variable (with the 'sizeof' operator) to
"semantic check phase".


On the other hand, some people/experts believe that such decisions of whether
something is a type or non-type idernfier has to be frozen/finished during
parsing and *SHOULD NOT* be deferred/delayed to 'semantic check phase'.


I am not an expert compiler researcher/scientist, so am seeking some opinion
here, if you happen to have a sound knowledge on this issue.


Many thanks.


Regards,
AD


Post a followup to this message

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