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


Groups > comp.compilers > #1123

Re: Having trouble converting composite variables to intermediate form

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.linkpendium.com!news.linkpendium.com!news.iecc.com!.POSTED!nerds-end
From Momchil Velikov <momchil.velikov@gmail.com>
Newsgroups comp.compilers
Subject Re: Having trouble converting composite variables to intermediate form
Date Fri, 28 Feb 2014 08:27:00 -0800 (PST)
Organization Compilers Central
Lines 28
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <14-03-001@comp.compilers> (permalink)
References <14-02-029@comp.compilers>
NNTP-Posting-Host news.iecc.com
Mime-Version 1.0
X-Trace miucha.iecc.com 1393698738 12472 64.57.183.58 (1 Mar 2014 18:32:18 GMT)
X-Complaints-To abuse@iecc.com
NNTP-Posting-Date Sat, 1 Mar 2014 18:32:18 +0000 (UTC)
Injection-Date Fri, 28 Feb 2014 16:27:00 +0000
Keywords analysis
Posted-Date 01 Mar 2014 13:32:18 EST
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:1123

Show key headers only | View raw


On Saturday, February 22, 2014 7:32:01 PM UTC+2, noitalmost wrote:
>
> x := r.a[2] + 5;
>

> After parsing, the Wirl AST fragment looks like:
>
> Assign
>   Ident x
>   Op +
>     RecAccess
>       Ident r
>       ArrAccess
>         Ident a
>         Num 2

You have currently

RecAccess(r, ArrAccess(Ident(a), Num(2)))

Note, however, that the array is not `a`, it's `r.a`. The subtree
`ArrAccess(Ident(a), Num(2)) `is incorrect, because you don't have in fact
a variable named `a` of an array type.

Here the record access should take precedence over array access, i.e.
the AST should look like:

ArrAccess(RecAccess(r, Ident(a)), Num(2))

Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Having trouble converting composite variables to intermediate form noitalmost <noitalmost@cox.net> - 2014-02-22 12:32 -0500
  Re: Having trouble converting composite variables to intermediate form Momchil Velikov <momchil.velikov@gmail.com> - 2014-02-28 08:27 -0800
  Re: Having trouble converting composite variables to intermediate form noitalmost <noitalmost@cox.net> - 2014-03-10 15:18 -0400

csiph-web