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


Groups > comp.compilers > #707

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED!nerds-end
From Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups comp.compilers
Subject Re: type or identifier fundamental parsing issue - Need help from parsing experts
Date Wed, 04 Jul 2012 11:43:08 +0100
Organization Compilers Central
Lines 31
Sender johnl@iecc.com
Approved comp.compilers@iecc.com
Message-ID <12-07-007@comp.compilers> (permalink)
References <12-07-004@comp.compilers>
NNTP-Posting-Host news.iecc.com
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace leila.iecc.com 1341694743 37234 64.57.183.58 (7 Jul 2012 20:59:03 GMT)
X-Complaints-To abuse@iecc.com
NNTP-Posting-Date Sat, 7 Jul 2012 20:59:03 +0000 (UTC)
Keywords types, parse, practice
Posted-Date 07 Jul 2012 16:59:03 EDT
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
Xref csiph.com comp.compilers:707

Show key headers only | View raw


AD schrieb:
> 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.

There exist pros and cons. The C preprocessor *requires* that sizeof
is a built-in *macro*, so that it can be used in #if conditions.

OTOH the size of structs depends heavily on the target environment,
alignments and other factors, so that I'd delay the evaluation until
code generation, where all involved factors are definitely known.

Anything between these extremes is possible as well. The real question
is: Do there exist reasons/situations, where sizeof *must* be evaluated
prior to the code generation/execution phase?

DoDi

Back to comp.compilers | Previous | NextPrevious in thread | Next 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