0% found this document useful (0 votes)
18 views5 pages

PPL Unit 2 Notes Remaining

The document provides an overview of preprocessors, programming environments, and the evolution of major programming languages. It explains the role of preprocessors in text manipulation before compilation, describes different types of programming environments, and outlines the characteristics and examples of various programming languages from pseudocode to Java. Additionally, it covers assembly language instructions and their operations.

Uploaded by

21f1000744
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)
18 views5 pages

PPL Unit 2 Notes Remaining

The document provides an overview of preprocessors, programming environments, and the evolution of major programming languages. It explains the role of preprocessors in text manipulation before compilation, describes different types of programming environments, and outlines the characteristics and examples of various programming languages from pseudocode to Java. Additionally, it covers assembly language instructions and their operations.

Uploaded by

21f1000744
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

Q.

Preprocessor: -

• A preprocessor is a software tool that performs these preprocessing tasks.

• It works as part of the language implementation system.

• In languages like C and C++, the preprocessor handles all text manipulation before
compilation begins.

Preprocessing

• Preprocessing is the first phase of program implementation that happens before


compilation. It involves simple text substitutions and directives processing carried
out on the source code, typically to make the program easier to write, read, and
maintain. The pre-processed result is then passed to the compiler for further translation
into machine code.

• Directives are written in the source code (in C/C++, these start with #).
Examples:

• #include → includes header files.


• #define → defines constants or macros.
• Conditional compilation (#ifdef, #endif).

• The preprocessor scans the source file and applies these directives:

• Expands macros.
• Inserts the contents of header files.
• Removes comments.
• Handles conditional compilation.

• The output is a modified source program (still in high-level language form) that is
passed to the compiler.

Q. Programming Environments: -
A programming environment is a complete setup of tools and facilities that supports the
process of software development. It provides everything a programmer needs to write,
compile or interpret, debug, and build software applications efficiently.

A programming environment typically includes:

• Editor → for writing and modifying source code.


• Compiler/Interpreter → for translating the code into machine-executable form.
• Debugger → for testing and identifying errors.
• Build Tools → for managing compilation, linking, and packaging.
• Optional GUI Designers → for visually designing applications with user interfaces.

Types of Programming Environments

1. Command-Line Tools
o The simplest form of programming environment.
o Programmers manually use individual tools for editing, compiling, and
debugging.
o Examples:
▪ Editors: Vim, Nano
▪ Compiler: GCC
▪ Debugger: GDB
2. Integrated Development Environment (IDE)
o Combines all essential tools (editor, compiler/interpreter, debugger, build
tools) into a single software package.
o Provides features like code completion, syntax highlighting, and project
management.
o Examples:
▪ Visual Studio → for C++, C#
▪ Eclipse → for Java
▪ PyCharm → for Python
▪ Code::Blocks, Dev-C++ → for C/C++
3. Web-Based Environments
o Cloud-based programming platforms accessible through a browser.
o Useful for collaboration, quick prototyping, and learning without installation.
o Examples:
▪ Replit
▪ Google Colab
▪ Jupyter Notebooks

Q. Evolution of Major Programming Languages: -


A. Pseudocode

• Definition: An informal high-level description of an algorithm’s logic.


• Not executable by computers; mainly used for design and planning.
• Purpose: To express algorithm flow clearly without worrying about syntax.

Example:

Start
Input A, B
Sum ← A + B
Print Sum
End

B. Assembly Language
• Low-level language that uses mnemonics (short codes like MOV, ADD) instead of
binary machine instructions.
• Machine-dependent → varies from one computer architecture to another.
• Requires an assembler to translate into machine code.

Example (Intel x86):

MOV AX, 5
MOV BX, 10
ADD AX, BX

C. FORTRAN (1957)

• First widely used high-level programming language.


• Designed for scientific and engineering applications.
• Specialized in mathematical computations with arrays and loops.

Example:

PRINT *, "HELLO WORLD"


END

D. C (1972)

• A system programming language created at Bell Labs by Dennis Ritchie.


• Used extensively for operating system development (e.g., UNIX).
• Combines low-level memory access with high-level programming.

Example:

#include <stdio.h>
int main() {
printf("Hello from C");
return 0;
}

E. C++ (1983)

• Developed as an extension of C by Bjarne Stroustrup.


• Adds Object-Oriented Programming (OOP) features like classes and objects.
• Supports both procedural and object-oriented styles.

Example:

#include <iostream>
using namespace std;

class Hello {
public:
void sayHi() {
cout << "Hello from C++";
}
};
int main() {
Hello h;
h.sayHi();
return 0;
}

F. Java (1995)

• Developed by Sun Microsystems (James Gosling).


• Platform-independent: “Write Once, Run Anywhere” via the Java Virtual Machine
(JVM).
• Fully Object-Oriented, with emphasis on security, robustness, and portability.
• Widely used for web, enterprise, and mobile applications.

Example:

public class Main {


public static void main(String[] args) {
System.out.println("Hello from Java");
}
}

Language Year Domain / Use Notable Features


FORTRAN 1957 Scientific, First high-level language, efficient for
Engineering numeric computation, loops, arrays, formula
translation.
LISP 1958 Artificial Functional style, recursion, symbolic
Intelligence processing, list-based structure.
COBOL 1959 Business English-like syntax, strong in file handling
Applications and record structures, suited for data
processing.
ALGOL 1960 General Purpose, Introduced block structure, structured
Academic programming, basis for many later languages
(Pascal, C).
BASIC 1964 Education, Simple, interactive, designed for ease of
Beginners learning, immediate execution (interpreter-
based).
Pascal 1970 Education, Strong typing, data structuring, teaching
Structured language, focus on reliability.
Programming
C 1972 System Combines low-level memory access with
Programming (e.g., high-level constructs, portable, efficient.
UNIX OS)
C++ 1983 General Purpose, Extension of C with Object-Oriented
System + Programming (OOP), supports classes,
Application inheritance, polymorphism.
Python 1991 General Purpose, Easy syntax, interpreted, multi-paradigm
Scripting, AI/ML (procedural, OOP, functional), large libraries.
Java 1995 Enterprise, Web, “Write Once, Run Anywhere”, JVM-based,
Mobile Object-Oriented, secure, portable, widely
used for enterprise applications.
Q. Introduction to Assembly Language Instructions: -
Assembly Language

• Assembly language is a low-level programming language that provides symbolic


instructions corresponding directly to CPU operations.
• Each instruction usually performs a very basic operation (move data, add, compare,
jump, etc.).
• Unlike high-level languages, assembly is machine-specific: the same code may not
run on different CPUs.
• An assembler is required to translate assembly language into machine code
(binary) so it can be executed by the processor.

Common Assembly Instructions

Instruction Meaning / Operation Example


MOV AX, BX → copy contents
MOV Move data between registers or memory
of BX into AX
Add numbers (register or immediate
ADD ADD AX, 5 → AX = AX + 5
values)
SUB AX, BX → AX = AX -
SUB Subtract numbers
BX
JMP LABEL → execution
JMP Unconditional jump to another instruction
jumps to LABEL
Compare two values (sets flags for
CMP CMP AX, BX
conditional jumps)
Jump if Zero flag is set (i.e., values are
JZ JZ END
equal)
Software interrupt (system-level call, e.g.,
INT INT 21H
I/O, DOS functions)

You might also like