Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #704

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

From AD <hsad005@gmail.com>
Newsgroups comp.compilers
Subject type or identifier fundamental parsing issue - Need help from parsing experts
Date 2012-07-03 11:30 -0700
Organization Compilers Central
Message-ID <12-07-004@comp.compilers> (permalink)

Show all headers | View raw


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

Back to comp.compilers | Previous | NextNext in thread | Find similar


Thread

type or identifier fundamental parsing issue - Need help from parsing experts AD <hsad005@gmail.com> - 2012-07-03 11:30 -0700
  Re: type or identifier fundamental parsing issue - Need help from parsing experts George Neuner <gneuner2@comcast.net> - 2012-07-04 00:57 -0400
    Re: type or identifier fundamental parsing issue - Need help from parsing experts torbenm@diku.dk (Torben Ægidius Mogensen) - 2012-07-11 12:17 +0200
  Re: type or identifier fundamental parsing issue - Need help from parsing experts Hans-Peter Diettrich <DrDiettrich1@aol.com> - 2012-07-04 11:43 +0100
    Re: C arcana, was type or identifier fundamental parsing issue - Need help from parsing experts "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2012-07-12 09:23 -0700

csiph-web