0% found this document useful (0 votes)
37 views21 pages

Desired Language Characteristics - Data Typing

The document discusses various topics related to programming languages and tools for real-time systems, including: 1) Desired characteristics of languages for real-time systems such as readability, portability, and flexibility in task scheduling. 2) Common programming constructs like data typing, control structures, hierarchical decomposition using blocks, procedures and functions. 3) Additional considerations for real-time systems like error handling, multitasking, and timing specifications. 4) Examples of languages and tools used for real-time systems programming like C, C++, Ada, and assembly languages.

Uploaded by

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

Desired Language Characteristics - Data Typing

The document discusses various topics related to programming languages and tools for real-time systems, including: 1) Desired characteristics of languages for real-time systems such as readability, portability, and flexibility in task scheduling. 2) Common programming constructs like data typing, control structures, hierarchical decomposition using blocks, procedures and functions. 3) Additional considerations for real-time systems like error handling, multitasking, and timing specifications. 4) Examples of languages and tools used for real-time systems programming like C, C++, Ada, and assembly languages.

Uploaded by

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

PROGRAMMING

LANGUAGES AND TOOLS


Unit - II
PROGRAMMING LANGUAGES
AND TOOLS

Desired language characteristics – Data typing – Control structures


– Facilitating hierarchical decomposition – Packages – Run time
error handling – Overloading and Generics – Multitasking – Low-
level programming – Task scheduling – Timing specification –
Some experimental languages – Programming environments – Run
time support
Cont.
In this presentation, we will
explore various desired language
characteristics, data typing, control
structures, hierarchical
decomposition, packages, run-time
error handling, overloading and
generics, multitasking, low-level
programming, task scheduling,
timing specification, experimental
languages, programming
environments, and runtime
support.
Desired Language Characteristics
• Real-time systems are computer systems that react to events by
performing tasks within a specific time interval, usually in
milliseconds.
• Examples of real-time systems include air traffic control systems,
process control systems, and autonomous driving systems.
Cont.
• language must be readable, must have constructs that enhance
clarity, be portable across different hardware platforms be modular,
and length themselves to being debugged and compiled separately.
• However real-time application Please some additional demands
under the programmer in two ways
1. they require that deadlines to met
2. Computers that interact with the device such as census are activated of
widely wearing cycles a good real-time language therefore making it
possible to write device interface effectively
• Real-time must be highly reliable in more systems the software is
much more complex than the hardware
• the probability of a software design fault is usually higher than the
fault in hardware design
Cont.
• Important part two reasons
1. it makes the debugging process easier
2. it makes possible the maintenance of the program even if the original
developers are no longer available
• Traditional approach to ensuring readability is to use commands
programmers or encourage to freely use commands through the
program
• example the variable name < Student Name > is much easier on
human days than <SN>
• Ex: < Student_Name > or < Student.Name >
• In most languages, indentation helps human programmer
• E.g. INT a,b:
SEQ
a:= PLUS b
B:= MINUS a
• The SEQ says that the instructions that lie within this scope must be
executed sequentially
Cont.
• a good language is as portable as possible
• Portability is difficult to ensure unless there is a central authority
that ensures the compiler written by different vendors is truly
equivalent
• There are two ways to avoid the problem
1. to ensure that specifications are written formally with no ambiguity
2. to have a committee to whom compiler writers can turn when they
detect an ambiguity in a specific function
• There is a committee for Ada to handle more inquiries
• A good real-time language must give programmer flexibility as to
the scheduling of processor and other resources
• the programmer must be able to specify when your tasks are to be
run and have control over the scheduling of all resource
Cont.
• none of the well-known languages like C, Pascal, and FORTRAN
have these capabilities
• Many real-time systems have a cyclic executive that is task and
periodically executed within the time slot for each task
• The program must manually fit the task into a time slot to meet hard
deadlines
• since the duration of these time slots cannot be changed by the
programmer it is sometimes necessary to content the code to make
fit in the slot
• it must be possible to compile and debug modules separately
• many real-time programs take our day of CPU time to compile
• this greatly increases software development costs and lowers
productivity
Some programming languages
and tools for real-time systems:
• C and C++: These languages are widely used in real-time systems
due to their efficiency and low-level control. They are widely adopted
in embedded systems and provide the efficiency needed for critical
tasks, ensuring optimal speed and resource management.
• Ada: This language is specifically designed for high-integrity real-
time systems. Ada 95 is a programming language commonly used in
the late 90s and is still widely used for real-time programming in the
defense and aerospace industries.
• Assembly language: This low-level programming language is used to
develop software for microcontrollers. Assembly language is used to
write code that is specific to the hardware that it is running on.
• Python and Java: These are also among the top five best-embedded
systems programming languages.
Data Typing
• When a programmer defines a variable as belonging to a
particular data type, he defines certain properties that the variable
must satisfy.
• For instance, if a variable X is defined as Boolean, the
programmer means X to have only two variables
• (1 and 0) or (true and Falls) and an assignment statement X = 5 is clearly illegal
• Data types are used by the programmer for 2 main purposes
• To guard against the programming error
• to specify the desired degree of numerical precision
• an example of a language in which data types do not provide
much security from programming errors in FORTRAN
• For example, a programmer meant to construct a Do-loop.
unfortunately, he typed a period, instead of a comma in the Do-
loop statement.
E.g.

do 100 i = 1, 50 do 100 i = 1. 50
J=j+1 J=j+1
100 continue 100 continue
Cont.
• Due to this error in FORTRAN compiler reads the intended do
statement as a perfectly legal assignment statement which leads to
an error in processing
• any variable that begins with the letter in the sequence a to h and o
to z is treated as a floating-point single-precision real number.
• While any variable begins with one of the letters k, l, m, n is
treated as an integer
Control Structures

•Sequential execution
•Selection (if-else statements)
•Iteration (loops)
•Conditional iteration (while, do-
while)
Control structures dictate how program
flow is managed. Sequential execution
follows a linear order. The selection allows
choosing paths based on conditions.
Iteration repeats a block of code until a
condition is met. Conditional iteration
combines selection and iteration for a
more complex control flow.
Cont.
• Most languages indirectly achieve a sequential execution of
instructions unless otherwise specified
• Decision structures providing if-then-else, for, and do-while clauses
are especially useful in providing correct readable code
• anyone who has programmed in C or Pascal will be familiar with
the structure
• the following examples are an if-then-else construct
if Y < 0 then
X :=4;
else if d = 0 then
X: = 6;
else
q: = 5;
end if
Cont.
The following example for –do loop;
for i in 0 …. 10 loop
d(i) :=i*j
end loop;

The following example of a while loop;


While x < p loop
X:= x + I;
end loop;
Facilitating Hierarchical
Decomposition

• The software for a complex system can


run to 100 of 1000 lines of code
• no one person can understand the
details to work of this quote much less
develop it or alone programming must
be a team effort

• Blocks
• Procedure and Functions
Cont.
•Breaking down complex problems into smaller, manageable modules
•Functions and procedures
•Encapsulation and information hiding
•Modularity and reusability

• Hierarchical decomposition involves dividing large tasks into


smaller, well-defined subtasks. Functions and procedures encapsulate
functionality, promoting modularity and code reuse.
• Information hiding keeps internal implementation details from
affecting other parts of the program, enhancing maintainability.
Blocks

• Consist of two parts: a specification that defines the variable


used within the block, and a body, that contains the statement to
be executed.
• A block may be placed anywhere in the program where the
statement is written
• the main purpose of a block is information hiding
• the variable declared within the block is accessible only within
the back and not the outside of the block
Cont.
E.g. The following piece of pseudocode

var i, x: integer;
begin
X:=0;
for i in 0…100 loop
block
var i : integer;
begin
For I in 1..5 loop
x:=x+i;
end loop;
end ;
end loop;
…….
Procedure and Functions
• The disadvantage of a block is that they must be explicitly
repeated every time they are needed
• In contrast a procedure or function can be written out once and
called whenever it is needed
• The entire program can be broken down into a set of procedures
and functions each of which may itself call other procedures and
functions
Cont.
for example, consider the following function

function MAXIMUM (A,B: integers) return integer is


begin
if A>B then
return A;
else
return B;
end if;
and MAXIMUM

You might also like