0% found this document useful (0 votes)
29 views4 pages

Local Data Referencing Environment

Principles of programming language notes

Uploaded by

Pooja Agnihotri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views4 pages

Local Data Referencing Environment

Principles of programming language notes

Uploaded by

Pooja Agnihotri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

LOCAL REFERENCING ENVIRONMENTS

Local Variables

 Vars
that are defined inside subprograms are called local vars.
 Local vars can be either static or stack dynamic.
 By default an variable in stack dynamic.
Advantages of using stack dynamic variable:
a. Support for recursion.

b. Storage for locals is shared among some subprograms.

Disadvantages of using stack dynamic variable:

a. Allocation/deallocation time required.

b. Indirect addressing “only determined during execution.”

c. Subprograms cannot be history sensitive “can’t retain data values of local vars

between calls.”

Advantages of using static variable:

a. Static local vars can be accessed faster because there is no indirection.

b. No run-time overhead for allocation and deallocation.

c. Allow subprograms to be history sensitive.

Disadvantages of using static variable:

a. Inability to support recursion.

b. Their storage can’t be shared with the local vars of other inactive subprograms.

Example for stack dynamic variable:

int addition(int a, int b) {

int sum = 0;

sum = a+b;

return sum;

Example for static variable:

//static variable uses static keyword


int addition(int a, int b) {

static int sum = 0;

sum = a+b;

return sum;

Nested Subprograms
 Residing of a subprogram under another subprogram is known as
nested subprogram.
 When a subprogram is placed within another subprogram,it gets hide
from the rest of the program.
 Algol 68, Pascal, Ada, JavaScript, Python, Ruby allows nesting of
subprogram.
 C, do not allow subprogram nesting.
Video lecture on Local Referencing Environments
References:
1. Sebesta,”Concept of programming Language”, Pearson Edu
2. Louden, “Programming Languages: Principles & Practices” ,
Cengage Learning
3. Tucker, “Programming Languages: Principles and paradigms “, Tata
McGraw –Hill.
4. E Horowitz, “Programming Languages”, 2nd Edition, Addison
Wesley
PPL
 Language Evaluation Criteria
 Influences on Language Design
 Programming Paradigm
 Compilation
 Virtual Machine | PPL
 Programming Environments | PPL
 Issues in Language Translation
 Parse Tree | PPL
 Pointer & Reference Type | PPL
 Concept of Binding
 Type Checking
 PPL: Strong Typing
 Sequence Control & Expression | PPL
 Subprograms
 Scope and lifetime of variable
 Static and Dynamic scope
 Design issues of subprogram
 PPL: Local referencing environments
 Parameter passing methods
 Overloaded subprograms
 Generic Subprograms
 Design issues for functions
 PPL: Coroutines
 Abstract Data types
 Abstraction and encapsulation
 Static and Stack-Based Storage management
 Garbage Collection
 OOP in C++ | PPL
 PPL: OOP in PHP
 OOP in C# | PPL
 OOP in Java | PPL
 Concurrency
 PPL: Semaphores
 Monitors
 Message passing
 PPL: Java Threads
 PPL: C# Threads
 PPL: Exception Handling
 Exception handler in Java
 Exception Propagation
 PPL: Exception Handler in C++
 PPL: Exceptions
 Introduction and overview of Logic programming
 Application of Logic programming
 Functional programming languages
 PPL: Introduction to 4GL
 Basic elements of Prolog
 Video Lectures
PPL Practicals
 Memory Implementation of 2D Array.
 Memory Implementation of 3D Array.
 Implementation of pointers in C++
 program in Java to implement exception handling
 Call by value in C++
 Call by reference in C++
 program in Java to implement concurrent execution of a job using
threads.
 Implement Inheritance in C#
 Implement Encapsulation in C#
 Static polymorphism in C#
 Dynamic runtime polymorphism in C#
EasyExamNotes © 2023

You might also like