9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Joel C. Salomon" <joelcsalomon@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: Re: [9fans] scopes in kencc
Date: Thu, 26 Apr 2007 22:48:17 -0400	[thread overview]
Message-ID: <7871fcf50704261948j6f33731bvd532e82de4572250@mail.gmail.com> (raw)
In-Reply-To: <20070427020447.C49F71E8C48@holo.morphisms.net>

On 4/26/07, Russ Cox <rsc@swtch.com> wrote:
> > where is it determined that LNAME is returned when *t is scanned
> > rather than LTYPE (the way it is returned in the declaration of foo)?
>
> grep shows that /sys/src/cmd/cc/lex.c is relevant,
> since it contains … the relevant bit of lexing.
> you could trace back and see how s->class gets set.

I've done that; I've traced through the code for two weeks now.  As
best as I can determine, s->class is set in the various dcl functions
in dcl.c.  And I still can't find how any sort of scope overiding is
done.

In my compilers class, the professor suggested using some linked list
of scopes so that lookup would always return the nearest symbol by a
given name (modulo namespace issues).  Since there's a single global
symbol table in kencc, what tells lookup to return the properly scoped
symbol?

Is there anyone active on 9fans that can give me a "bird's eye view"
of kencc's internal structures?  I've read Johnson's "A Tour Through
the Portable C Compiler" in the v7 manual, and I'd guess that kencc
does something similar to pcc as described in the "Symbol Table
Maintenance" section -- I just don't find it in the code.

--Joel

  reply	other threads:[~2007-04-27  2:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-27  1:12 Joel C. Salomon
2007-04-27  2:04 ` Russ Cox
2007-04-27  2:48   ` Joel C. Salomon [this message]
2007-04-27  3:02     ` Russ Cox
2007-04-27  4:35       ` Joel C. Salomon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7871fcf50704261948j6f33731bvd532e82de4572250@mail.gmail.com \
    --to=joelcsalomon@gmail.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).