0% found this document useful (0 votes)
41 views24 pages

UNIT 5 High

The document discusses data structures and recursion. It defines data structures as how data is organized and related to efficiently manage data flow. Recursion in data structures involves a function indirectly or directly calling itself by breaking down a problem into smaller subproblems. The key properties of recursion include using the call stack, calling the function with different inputs, needing a base case, and potentially being less efficient than iteration.

Uploaded by

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

UNIT 5 High

The document discusses data structures and recursion. It defines data structures as how data is organized and related to efficiently manage data flow. Recursion in data structures involves a function indirectly or directly calling itself by breaking down a problem into smaller subproblems. The key properties of recursion include using the call stack, calling the function with different inputs, needing a base case, and potentially being less efficient than iteration.

Uploaded by

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

UNIT 5

((DATA STRUCTURE))
Static, Automatic, External Control & Based Storage. Implementation, Block structure

1.INTRODUCTION

The study of data structures helps to understand the basic concepts involved in organizing and storing
data as well as the relationship among the data sets. This in turn helps to determine the way information is
stored, retrieved and modified in a computer’s memory.

2. BASIC CONCEPT OF DATA STRUCTURE

Data structure is a branch of computer science. The study of data structure helps you to understand how
data is organized and how data flow is managed to increase efficiency of any process or program. Data
structure is the structural representation of logical relationship between data elements. This means that a
data structure organizes data items based on the relationship between the data elements. Example: A
house can be identified by the house name, location, number of floors and so on. These structured set of
variables depend on each other to identify the exact house. Similarly, data structure is a structured set of
variables that are linked to each other, which forms the basic component of a system.

3.IMPLEMENTATION

Data structures are generally based on the ability of a computer to fetch and store data at any place in its
memory, specified by a pointer—a bit string, representing a memory address, that can be itself stored in
memory and manipulated by the program. Thus, the array and record data structures are based on computing
the addresses of data items with arithmetic operations, while the linked data structures are based on storing
addresses of data items within the structure itself.
The implementation of a data structure usually requires writing a set of procedures that create and manipulate
instances of that structure. The efficiency of a data structure cannot be analyzed separately from those
operations. This observation motivates the theoretical concept of an abstract data type, a data structure that is
defined indirectly by the operations that may be performed on it, and the mathematical properties of those
operations (including their space and time cost).

Examples-An array is a number of elements in a specific order, typically all of the same type (depending on
the language, individual elements may either all be forced to be the same type, or may be of almost any type).
Elements are accessed using an integer index to specify which element is required. Typical implementations
allocate contiguous memory words for the elements of arrays (but this is not always a necessity). Arrays may
be fixed-length or resizable.

4.RECURSION

Recursion in data structure is when a function calls itself indirectly or directly, and the function
calling itself is known as a recursive function. It's generally used when the answer to a larger
issue could be depicted in terms of smaller problems.
In recursion in data structure, a method or a function has the capability to decode an issue. In the
process of recursion, a problem is resolved by transforming it into small variations of itself. In
this procedure, the function can call itself either directly or indirectly. Based on the differences in
call recursion in data structure can be categorized into different categories. You will get to know
about these categories later in the blog.

Recursion in data structure is additionally an adequate programming technique. A recursive


subroutine is described as one that directly or indirectly calls itself. Calling a subroutine
specifically indicates that the characterization of the subroutine already has the call statement of
calling the subroutine that has been defined.

Properties of Recursion

1. Recursive algorithms rely on the call stack: When a recursive function is


called, it adds a new frame to the call stack, which stores the function's
local variables and the return address. When the function completes, the
frame is removed from the stack, and the control returns to the previous
frame. This is one of the important properties of recursion
2. Recursion involves calling the same function with different inputs: A
recursive function is one that calls itself with a different set of parameters
than the current call. This allows the function to break down a complex
problem into smaller, simpler sub problems until the base case is reached.
3. Every recursive algorithm must have a base case: The base case is the
condition under which the recursion stops. It is important to define a base
case to prevent infinite recursion, which can lead to stack overflow and
cause the program to crash. This is one of the important properties of
recursion
4. Recursive algorithms can be slower than iterative ones: Recursion can be
slower than iteration because of the overhead of function calls and stack
management. In some cases, it may be possible to convert a recursive
algorithm into an iterative one, but this is not always straightforward.
5. Recursion can lead to elegant and concise code: Recursive algorithms can
often be expressed more elegantly and concisely than iterative ones,
especially for problems that involve tree structures, such as binary search
trees and binary trees. This is one of the important properties of recursion
in data structure
6. Recursion can lead to code that is harder to understand and
debug: Recursive algorithms can be more difficult to understand and
debug than iterative ones, especially for complex problems that involve
multiple recursive calls. It is important to write clear and well-documented
code to make it easier to understand and maintain. This is one of the
important properties of recursion in data structure
7. Recursion can be used to implement backtracking algorithms: Backtracking
algorithms involve searching through a solution space to find a solution,
and then backtracking to try other paths if the current path does not work.
Recursion can be used to implement backtracking algorithms in an elegant
and efficient way. This is one of the important properties of recursion in
data structure

Advantages of recursion
1. Clarity and simplicity: Recursion can make code more readable and easier
to understand. Recursive functions can be easier to read than iterative
functions when solving certain types of problems, such as those that
involve tree or graph structures.
2. Reducing code duplication: Recursive functions can help reduce code
duplication by allowing a function to be defined once and called multiple
times with different parameters.
3. Solving complex problems: Recursion can be a powerful technique for
solving complex problems, particularly those that involve dividing a
problem into smaller sub problems. For example, recursive algorithms are
commonly used in sorting, searching, and traversing data structures like
trees and graphs.
4. Memory efficiency: Recursive algorithms can be more memory-efficient
than iterative algorithms when working with certain types of data
structures. For example, when traversing a binary tree, a recursive
algorithm may only need to keep track of the current node and the two
sub trees, while an iterative algorithm may need to keep track of a stack of
nodes.
5. Flexibility: Recursive functions can be more flexible than iterative functions
because they can handle inputs of varying sizes without needing to know
the exact number of iterations required. This makes them particularly
useful for dealing with problems that have a variable or unknown input
size.

Disadvantages of recursion
1. Performance Overhead: Recursive algorithms may have a higher
performance overhead compared to iterative solutions. This is because
each recursive call creates a new stack frame, which takes up additional
memory and CPU resources. Recursion may also cause stack overflow
errors if the recursion depth becomes too deep.
2. Difficult to Understand and Debug: Recursive algorithms can be difficult to
understand and debug because they rely on multiple function calls, which
can make the code more complex and harder to follow.
3. Memory Consumption: Recursive algorithms may consume a large amount
of memory if the recursion depth is very deep. This can lead to memory-
related issues, such as running out of memory or causing the system to
slow down.
4. Limited Scalability: Recursive algorithms may not scale well for very large
input sizes because the recursion depth can become too deep and lead to
performance and memory issues.
5. Tail Recursion Optimization: In some programming languages, tail
recursion optimization is not supported, which means that tail recursive
functions can be slow and may cause stack overflow errors

Algorithm for recursion


1. Define the base case: Identify the simplest problem that can be solved
without recursion.
2. Define the recursive case: Identify how to break the problem down into
smaller sub-problems that can be solved recursively.
3. Call the function recursively: Invoke the function again with the smaller
sub-problem(s) as input.
4. Combine the results: Use the results of the recursive calls to solve the
original problem.
5. Return the solution: Return the final solution to the original problem.

5.Call & Return Statements:


A return statement ends the execution of a function, and returns control to the calling function.
Execution resumes in the calling function at the point immediately following the call.
A return statement can return a value to the calling function. For more information, see Return
type.

Syntax
jump-statement:
return expressionopt ;

The value of expression, if present, is returned to the calling function. If expression is


omitted, the return value of the function is undefined. The expression, if present, is
evaluated and then converted to the type returned by the function. When
a return statement contains an expression in functions that have a void return type, the
compiler generates a warning, and the expression isn't evaluated.

If no return statement appears in a function definition, control automatically returns to


the calling function after the last statement of the called function is executed. In this
case, the return value of the called function is undefined. If the function has a return
type other than void, it's a serious bug, and the compiler prints a warning diagnostic
message. If the function has a void return type, this behavior is okay, but may be
considered poor style. Use a plain return statement to make your intent clear.

As a good engineering practice, always specify a return type for your functions. If a
return value isn't required, declare the function to have void return type. If a return type
isn't specified, the C compiler assumes a default return type of int.

Many programmers use parentheses to enclose the expression argument of


the return statement. However, C doesn't require the parentheses.

The compiler may issue a warning diagnostic message about unreachable code if it finds
any statements placed after the return statement.

6.Storage Classes
the storage class in the C language for determining the visibility, lifetime, initial value, and
memory location of any given variable. The storage classes define the visibility (scope) and the
lifetime of any function/ variable within a C program. These classes precede the type that they
are going to modify.

Types of Storage Classes in C

There are four different types of storage classes that we use in the C language:

• Automatic Storage Class


• External Storage Class
• Static Storage Class
• Register Storage Class

Automatic Storage Class

It is also known as the auto storage class, and it acts as the default storage class for all the
variables that are local in nature.

For example,

int mount;

auto int month;


}

Look at the example that we used above- it defines two of the variables in the very same storage
class. One can use ‘auto’ only within the functions- or the local variables.

Features of automatic variables:

• The allocation of memory for these variables occurs automatically during the runtime.
• The scope of an automatic variable is limited to that block in which we are defining them.
• The visibility of these variables is also limited to that block in which we are defining
them.
• The initialization of these variables is, by default, a garbage value.
• The memory that is assigned to an automatic variable gets free when it exits from a
block.
• We use the keyword auto to define the automatic variables.
• Any local variable that exists in the C language is, by default, automatic in nature.
Let us look at an example,

#include <stdio.h>

int main()

int p; //auto

char q;

float r;

printf(“%d %c %f”,p,q,r); // to print the initial default value of the automatic variables p, q, and
r.

return 0;

The output generated here would be:

garbage garbage garbage

Let us look at another example,

#include <stdio.h>
int main()

int p = 10,i;

printf(“%d “,++p);

int p = 20;

for (i=0;i<3;i++)

printf(“%d “,p); // 20 will be printed here 3 times because it is the given local value of p

printf(“%d “,p); // 11 will be printed here since the scope of p = 20 has finally ended.

The output generated here would be:

11 20 20 20 11

External Storage Class

It is also known as the extern storage class, and we use it for giving a reference of any global
variable which is visible to all the files present in a program. When using the extern storage
class, we cannot initialize the variable. However, note that it points to the name of the variable at
any storage location that we have already defined (previously).

Whenever we have multiple numbers of files while we are trying to define any global variable or
a function (that will be used in various other files too), then we will use the extern in another file
for providing the reference of the defined function or variable. In simpler words, we use the
entern for declaring a function or a global variable in another file.

The most common use of the extern modifier is when we have two or more than two files that
share a similar global variable or function.
For example:

main.c (File 1) –

#include <stdio.h>

int count ;

variable void write_variable();

main() {

count = 38;

write_variable();

support.c (File 2) –

#include <stdio.h>

variable int count;

void write_variable(void) {

printf(“The variable for the program is %d\n”, count);

In this example, we have used the extern keyword for declaring the variable available in the
second file. On the other hand, its definition actually resides in the main.c (that is its first file).
Now, the compilation of both of these files will be as follows:

$gcc main.c support.c

This step will generate a program a.out that is executable in nature. When we perform the
execution of this program, we will get a result as follows:

The variable for the program is 38

The features of external variables:

• We use the external storage class for conveying to the compiler that the variable that has
been defined as the extern has been declared using an external linkage that exists
elsewhere in any program.
• One can only perform the initialization of an external variable globally. In other words,
one cannot perform the initialization of an external variable within any given method or
block.
• The variables that are declared as extern have no allocation of memory. It only has a
declaration, and it intends to specify that the given variable has been declared elsewhere
in the available program.
• An external integral type’s default initial value is going to be 0, or else it is null.
• We can initialize an external variable multiple times, but we can only initialize it a single
time.
• When we declare a variable as external, the compiler will start searching for that variable
for initialization somewhere in the available program. It might be static or extern. In case
it isn’t, the compiler will ultimately generate an error (a compile-time error).
Let us look at an example,

#include <stdio.h>

int a;

int main()

extern int a; // variable a is defined globally, the memory will not be allocated to a

printf(“%d”,a);

The output generated here would be:

Let us look at another example,

#include <stdio.h>

int main()

extern int x; // The compiler will start searching here if a variable x has been defined and
initialized in the program somewhere or not.

printf(“%d”,x);

}
int x = 20;

The output generated here would be:

20

Let us look at one final example,

extern int x;

int x = 10;

#include <stdio.h>

int main()

printf(“%d”,x);

int x = 20; // the compiler will generate an error at this line in the output

The output generated here would be:

Compile-time error

Static Storage Class

This type of storage class gives an instruction to a compiler to keep the given local variable
around during the program’s lifetime- instead of creating it and then destroying it every time it
comes into a scope and goes out of it. Thus, when we make a local variable static, it allows the
variable to maintain the values that are available between various function calls.

We may also apply a static modifier to a global variable. When we do so, it will cause the scope
of the variable to be restricted to that file in which its declaration happened.

In a C programming language, when we use the static on a global variable, it will cause all the
objects present in a class to share a single copy of that given member.

For example,

#include <stdio.h>
/* declaration of function */

void func(void);

/* a global variable */

static int count = 10;

main() {

while(count–) {

func(); /* increment of function */

return 0;

void func( void ) {

/* definition of function */

static int x = 10; /* a local type of static variable */

x++;

printf(“x is %d and the count is %d\n”, x, count);

The compilation and execution of this code mentioned above will produce the result as follows:

When the above code is compiled and executed, it produces the following result −

x is 11 and the count is 9

x is 12 and the count is 8

x is 13 and the count is 7

x is 14 and the count is 6

x is 15 and the count is 5

Features of static variables:


• Those variables that we define as static specifiers are capable of holding their assigned
value that exists between various function calls.
• The static local variables are only visible to the block or the function in which we have
defined them.
• We can declare the very same static variable multiple times, but we can only assign it a
single time.
• The initial value of a static integral variable, by default, is 0. Else, it is null.
• We use the static keyword in the case of a static variable.
• The visibility of any static global variable stays limited to that file in which we have
declared it.
Let us look at an example,

#include<stdio.h>

static float f;

static int i;

static char c;

static char s[100];

void main ()

printf(“%d %d %f %s”,c,i,f); // the initial default value of c, i, and f will be printed.

The output generated here would be:

0.000000 0 0 (null)

Let us look at another example,

#include<stdio.h>

void sum()

static int x = 20;

static int y = 34;


printf(“%d %d \n”,x,y);

x++;

y++;

void main()

int a;

for(a = 0; a< 3; a++)

sum(); // Given static variables will hold their values between the various function calls.

The output generated here would be:

20 34

21 35

22 36

Register Storage Class

We use the register storage class for defining the local variables that must be stored in any
register, and not in a RAM. It means that the maximum size of this variable is equal to that of the
register size (it is usually one word). Also, we cannot apply the ‘&’ unary operator to it because
it has no memory location.

For example,

register int miles;


}

We must only use the register in the case of those variables which require quick access, such as
the counters. We must also note that defining a register doesn’t mean that this variable would be
stored in any register. It rather means that this variable MIGHT or might not be stored in a
register. It totally depends on the hardware and also the restrictions of implementation.

Features of register variables:

• Those variables that we define as the register have their memory allocation into the CPU
registers. It depends totally upon the size of the memory that remains in the CPU.
• Its access time is comparatively much faster than that of the automatic variables.
• One cannot dereference a register variable. In other words, one cannot make use of the
‘&’ operator in the case of a register variable.
• The default initial value of any given register local value will always be 0.
• We use the register keyword for the variable that must be stored in a CPU register.
However, whether a variable must be stored in a register or not is always going to be the
choice of the compiler.
• One can easily store the pointers in a register. It means that any register is capable of
storing the given variable’s address.
• We cannot store a variable into a register since we can’t really utilize more than one
storage specifier for the very same variable.

External Control & Based Storage :


What is an external control?
An external control is any sort of influence from outside of an organization that affects
how it operates. External controls specifically focus on regulating on a company's
governance policies, such as hiring policies and safety procedures. They include direct
rules, such as government regulations, and indirect pressure, such as scrutiny from the
media. An external control can change a business's internal policies, encourage an
organization to comply with industry practices or influence the relationship between a
company and its business partners.

Related: Corporate Governance: Definition and How It Works

Internal vs. external controls

Internal and external controls both influence the way a company regulates its business
practices. Internal controls are the steps an organization takes to manage its own
operations and create consistent outcomes in the workplace. These can include overall
company values and best practices for accomplishing goals. For example, a company
that values environmental sustainability uses that characteristic as an internal control
when choosing business partners, suppliers and production methods.

Some internal controls are based on external controls. For example, if the government
passes a law setting limits on certain financial transactions, a company may proactively
hire an internal auditor to review its financial policies.

Why are external controls important?


External controls are important because they ensure that organizations are accountable
for their actions and meet a certain standard of behavior. In several industries, external
controls ensure that businesses provide employees with a healthy work
environment and give consumers access to high-quality products. Here are some of the
key reasons external controls exist:

• Creating consistent industry standards: External controls strive to


apply the same standard of performance and operational behavior for all
businesses within an industry. They ensure that all companies in the
same sector follow the same rules and use similar governance
practices.
• Improving work conditions: By adhering to external controls,
organizations uphold conditions for their employees and regularly strive
to improve the quality of life for their team members. External controls
such as labor laws and federal regulations ensure that employees have
access to safe conditions in the workplace.
• Promoting transparency: Many external controls focus on
transparency regarding how organizations operate and require
companies to share information about their policies and governance.
This gives consumers and members of the public details about the
products and services they purchase.
• Upholding corporate responsibility: External controls encourage
organizations to be more responsible about how their operations
influence their community and environment. This can lead to more
inclusive hiring practices, more sustainable manufacturing procedures
and other long-term operational benefits.

Related: Guide to Safety Rules in the Workplace (With Tips To Maintain a Safe
Environment)

Who uses external controls?


Managers and business leaders use external controls to construct and update policies
on their team. External controls are also important for anyone who works in a
compliance role, because compliance professionals need to understand all relevant
laws and regulations when determining if their team, department or project meets all
necessary requirements. You can use external controls in any industry, but they're
particularly important for professionals in these fields:

• Finance and accounting


• Human resources and labor
• Construction and manufacturing
• Healthcare and pharmaceuticals

You may also consider working in the field of regulatory affairs, where you create the
external controls that influence how businesses operate. Both the people who create
regulations and those who uphold internal compliance to external controls have
important roles in creating industries with high standards for consumers and
professionals.

Related: 8 Types of Compliance Jobs (With Examples for Each Field)

Do you need help with your resume?

YesNo

Examples of external controls


Here are several types of external controls with an explanation of each:
Government regulations

One of the most direct types of external controls is government regulations and laws
that influence how companies can operate. They're also highly effective because they
have immediate consequences for businesses that don't comply. When an organization
doesn't follow a government regulation for business operations, it may need to pay an
expensive fine or follow an operational penalty. Government regulations cover any
aspect of organizational governance, from employment practices to how the company
advertises its products. Some examples of external government controls include:

• Laws limiting the locations where oil companies can extract resources
• Regulations regarding how companies can use and share data from
customers
• Tax code explaining how much businesses owe on different types of
company earnings

Industry standards

Standards within an industry are another type of external control. Professional


organizations can set their own regulations and expectations for how companies and
professionals operate to achieve respect and renown in their industry. Some
professional organizations have additional requirements and expectations for members
to join, which raises the standard for success in that field. Industry groups may also
lobby for laws and rules to change or create public pressure for certain companies to
change their internal governance structures.

Information releases

When companies release information, such as yearly financial reports, this information
can act as an external control. Even the knowledge that information is eventually going
to be public can encourage company leaders to make more responsible, ethical choices
about their business. This can include sharing information within the company,
submitting details to shareholders or releasing reports to the public. For example, some
government regulations require businesses to release certain financial information to
the public to uphold financial accountability.

Changes in leadership

If one company purchases another, a merger occurs or a business simply hires a new
person in a leadership position, this can increase awareness of the organization's
internal governance structure. In especially large, public companies, a change in
leadership can also attract attention from the public and media to the company's
business practices. Before a change in leadership, current company leaders may make
adjustments to the governance structure to improve compliance or simply make the
business more organized for the successor.
Related: How To Make a Change in Leadership Announcement

External audits

External controls can occur between business partners and departments through
external audits. One company may hire an external auditor to review the business
practices of a potential business partner before agreeing to a business relationship. This
type of external control is common between retailers and suppliers or companies that
want to ensure that they're doing business with companies that have ethical and
sustainable governance practices.

Media relations

Public perception and media coverage can also influence an organization's internal
policies and operational procedures. Investigative journalists may report on an issue
within a company and use pressure from the public to encourage company leaders to
change their policies. Social values and changing opinions can also cause businesses
to adapt their values and adjust their practices so they can appeal to their target
audience.

Non local Goto


Goto (goto, GOTO, GO TO, GoTo, or other case combinations, depending on the programming
language) is a statement found in many computer programming languages. It performs a one-
way transfer of control to another line of code; in contrast a function call normally returns
control. The jumped-to locations are usually identified using labels, though some languages
use line numbers. At the machine code level, a goto is a form of branch or jump statement, in
some cases combined with a stack adjustment. Many languages support the goto statement,
and many do not (see § language support).

Interrupts:
When an interrupt occurs, it is the responsibility of the interrupt dispatching software
to save the context of the processor such that an ISR written in a high-level language
(typically C) can be invoked without damaging the state of the task that was
interrupted. In general, this results in the saving of registers which are NOT preserved
across subroutine calls as well as any special interrupt state. A port should define the
CPU_Interrupt_frame structure so that application code can examine the saved state.
typedef struct {
unsigned32 not_preserved_register_1;
unsigned32 special_interrupt_register;
} CPU_Interrupt_frame;

Pointers:
Pointer is used to points the address of the value stored anywhere in the computer memory.
To obtain the value stored at the location is known as dereferencing the pointer. Pointer
improves the performance for repetitive process such as:

o Traversing String
o Lookup Tables
o Control Tables
o Tree Structures

Pointer Details
o Pointer arithmetic: There are four arithmetic operators that can be used in
pointers: ++, --, +, -
o Array of pointers: You can define arrays to hold a number of pointers.
o Pointer to pointer: C allows you to have pointer on a pointer and so on.
o Passing pointers to functions in C: Passing an argument by reference or by
address enable the passed argument to be changed in the calling function by the
called function.
o Return pointer from functions in C: C allows a function to return a pointer to
the local variable, static variable and dynamically allocated memory as well.
Interpreter
An interpreter is a program that directly executes the instructions in a
high-level language, without converting it into machine code. In
programming, we can execute a program in two ways. Firstly, through
compilation and secondly, through an interpreter. The common way is
to use a compiler.

Strategies of an Interpreter
It can work in three ways:

• Execute the source code directly and produce the output.


• Translate the source code in some intermediate code and then
execute this code.
• Using an internal compiler to produce a precompiled code. Then,
execute this precompiled code.
Types of an Interpreter in Programming
1. Bytecode Interpreters

• The source code is firstly converted to bytecode.


• Bytecode is a compressed and optimized representation of source
code. But, it is not the machine code.
• The bytecode interpreters then execute this compiled code
• Compiler and interpreter both are used hence, the name
‘compreters’.
• Each instruction starts with a byte. Therefore, they have up to 256
instructions.
2. Threaded Code Interpreters

• Similar to bytecode interpreters but, they use pointers.


• Each instruction is a word acting as a pointer. This pointer points to a
function or instruction sequence.
• There is no restriction on the number of instructions. Considering
that, memory and address space is available.
3. Abstract Syntax Tree Interpreters

• It converts the source code to an abstract syntax tree (AST).


• Then it executes the program according to this tree.
• Each sentence is parsed just once.
• The program structure and the relation between statements remain
the same.
• Provides better analysis during run time
4. Self Interpreters

• These are a special type of interpreters.


• They are programming language interpreters written in a
programming language that can interpret itself.
• An example can be a BASIC interpreter written in BASIC.
• Self interpreters are created in case if no compiler exists for a
language.
• Their creation requires the implementation of that language in a
host language. This host language can be another programming
language.

Pure and impure interpreters


• In a pure interpreter, the source program is maintained in the source form throughout
its interpretation. This arrangement acquires substantial analysis overheads when
interpreting a statement.
• An impure interpreter carries out some preliminary processing of the source program
to decrease the analysis overheads during interpretation. The preprocessor
transforms the program to an intermediate representation (IR) that is used during
interpretation. This speeds up interpretation since the code component of the IR that
is the IC, can be analyzed more resourcefully than the source form of the program.

You might also like