CIS 400 LECTURE 22

 

Continuing from last time: dynamic activation stack

 

 

 

 

 

 

 

 

 

 

 

 

 

Static chain activation stack:

 

 

 

 

 

 

 

 

 

 

C has a link back to B

Often denoted C[static link[I]]

Or

C®®X,    ( a pointer to a pointer)

 

 

 

 

 

 

 

 

For non-local references, there is an alternative to traversal of static chain:

In order to speed things up…

1)      Central referencing table, (similar to what is found in Lisp)

2)      Display, (copy of static activation chain)

 

 

 

Exceptions:

Issues:

1)      Raising exceptions

2)      Propagating the exception

3)      After exception is handled, where does execution go?

 

Fundamental issues:

1)      Who raises exception, (programmer or machine)?

2)      Propagation issue, where do you look to find a handler? (static or dynamic scope)

3)      Execution: continue, terminate and clean-up, or continue with next statement?

 

Semantics for dealing with exceptions:

 

 

 

 

 

 

 

 

Exceptions:

 

PL/1, (first with exception handlers)

 

CLU

 

e.g.

for_fun = proc(a:int, b:real)

            return(int)

     signals(zero(int), overflow, bad_format(string))

 

MESA

Terminology: signals and catches

1)      Signal

2)      An error

3)      Return with error

 

 

ADA

 

Flaws in Ada handling:

1)      No parameter transmission

2)      Dynamic chain sometimes takes you t unexpected places

3)      No compiler on type checking for exception