Re: How to handle qualified identifiers such as x.y in a Pascal-like language

"\[Linux Magazine\]" <uu3kw29sb7@snkmail.com>
Fri, 24 Jun 2011 13:58:23 +0200

          From comp.compilers

Related articles
How to handle qualified identifiers such as x.y in a Pascal-like langu noitalmost@cox.net (noitalmost) (2011-06-20)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l torbenm@diku.dk (2011-06-22)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l DrDiettrich1@aol.com (Hans-Peter Diettrich) (2011-06-22)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l gene.ressler@gmail.com (Gene) (2011-06-22)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l noitalmost@cox.net (noitalmost) (2011-06-23)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l DrDiettrich1@aol.com (Hans-Peter Diettrich) (2011-06-24)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l uu3kw29sb7@snkmail.com (\[Linux Magazine\]) (2011-06-24)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l gneuner2@comcast.net (George Neuner) (2011-06-24)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l gene.ressler@gmail.com (Gene) (2011-06-24)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l DrDiettrich1@aol.com (Hans-Peter Diettrich) (2011-06-25)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l gneuner2@comcast.net (George Neuner) (2011-06-25)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l noitalmost@cox.net (noitalmost) (2011-06-29)
Re: How to handle qualified identifiers such as x.y in a Pascal-like l dot@dotat.at (Tony Finch) (2011-06-29)
[8 later articles]
| List of all articles for this month |

From: "\[Linux Magazine\]" <uu3kw29sb7@snkmail.com>
Newsgroups: comp.compilers
Date: Fri, 24 Jun 2011 13:58:23 +0200
Organization: Compilers Central
References: 11-06-037 11-06-040
Keywords: symbols, storage
Posted-Date: 24 Jun 2011 21:00:20 EDT

A follow up to the discussion on displays and linked list of stack
frames. Many languages allow for storing references to procedures in
variables, or passing procedures as parameters. One example is the
GNU variant of C and C++ implemented in GCC, which allows for both AND
nested procedures.


If thread starters language include storing references to procedures
and/or passing procedures as parameters, then thread starter needs to
consider, how to store references to procedures, and he better
consider it now.


When using linked lists of stack frames, the normal way of storing
references to procedures is to store a reference to the start of the
code implementing the procedure and a reference to the start of the
linked list of stack frames. Thus you have a record with two fields.
When using displays you have the problem of storing the display
somewhere. In some cases GCC uses something like trapezes for storing
references to procedures without having a record with two fields.
Unfortunately that involves storing code in writable storage, and that
is a big no no for security reasons. Storing code in writable storage
makes life so much easier for hackers.


In practice people do not write procedures in procedures that much, and
procedures in procedures in procedures are rare. This also means that
you need efficient access to global variables and variables local to the
procedure currently being executed. Further the access to variables
declared in the directly surrounding scope should be fairly efficient.
The rest just needs to work. You will do fine with an implementation
where all procedures have direct access to its own variables and global
variables, and variables declared in surrounding procedures may be more
difficult to access.



Post a followup to this message

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