0% found this document useful (0 votes)
21 views13 pages

Assingment Cse

The assignment discusses the need for translators in programming, how they function, and the evolution of programming languages across five generations. It highlights the importance of translators in converting high-level languages to machine code, making programming more accessible. Additionally, it explores future trends such as AI integration and cloud-based development tools.
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)
21 views13 pages

Assingment Cse

The assignment discusses the need for translators in programming, how they function, and the evolution of programming languages across five generations. It highlights the importance of translators in converting high-level languages to machine code, making programming more accessible. Additionally, it explores future trends such as AI integration and cloud-based development tools.
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/ 13

J. K.

Institute of Applied Physics


and Technology
Assignment (Theory Paper) [2024-25]

Team No – 03
Assingment Topic- Need of translator, how
translator works, generations of programming
language, how programming language evolved.

Team Members and Contributions :-

1. David Tembhare (Lead)


o Coordinated the project, delegated tasks, and ensured the assignment
was completed on time.
o Conducted detailed research on the Evolution of Programming
Languages and Future Trends in Translators.
o Designed the flowchart for the Compilation Process and contributed to
the timeline diagram for programming languages.
2. Abhishek Srivastava(Researcher)
o Researched and compiled information on the Need for Translators and
How Translators Work.
o Provided examples of real-world applications of programming languages
and translators.
o Wrote the Challenges and Limitations section of the document.
3. Lakshya Mittal(Writer)
o Wrote content for Generations of Programming Languages and Key
Features of Programming Languages.
o Suggested additional examples and case studies to enhance the
assignment.
4. Banoth Saraswathi(Designer)
o Designed diagrams, flowcharts, and tables, including:
 Comparison of Compilers, Interpreters, and Assemblers.
 Flowchart for the Interpretation Process.
o Formatted the Word document, ensuring a professional and visually
appealing layout.
Table of Contents

1) Introduction

2) Need for Translators

3) How Translators Work

4) Generations of Programming Languages

5) Evolution of Programming Languages

6) Challenges and Limitations of Translators

7) Future Trends and Scope of Translators


Introduction
Programming languages and translators are important part of computer system.
Programming languages is a way for human to interact with computer . These languages are
medium for humans to tell computer what they have to do. But computer understands only
machine language that is binary code.
.
Programming languages are specific tools that we use to convert our written code into
machine language that computer can understand. Without translator we would have to write
the code in binary language that would be very difficult .
In this assignment, we will look at:
 Why we need translators:How translator makes programming easier .
 How translators work: how tools like compilers and interpreters change code into
machine language.
 How programming languages have changed:how programming languages have
improved over time.
 What the future of translators might look like: We will talk about new technologies,
like AI, and how they could change translators.
Because of translators we don’t need to write difficult machine code. We can use
programming languages like Python, which are easier to read and understand. Python is a
popular language, especially for beginners, because it looks a lot like English.

Fun Fact: Python is named after a TV show called "Monty Python's Flying Circus," not the
snake! The creator of Python, Guido van Rossum, liked the show and wanted a fun name for
the language.
Need for Translators
They help change high-level programming languages (like C++, Python, or Java)
into machine code because it is the only language computers can understand.
Without translators it is impossible for computers to run any of the programs we
write.
Translators let programmers focus on solving problems and writing code, instead
of worrying about how to talk to the computer’s hardware. This makes
programming much easier and faster

.
How Translators Work
Translators are tools that help convert the code written by programmers into machine code
so that the computer can understand and run it. There are three main types of translators, and
each works in a different way:
1. Compilers

A compiler converts an entire program written in a high-level language into machine code at
once. The resulting machine code can be saved and executed multiple times without
recompilation.

1. Lexical Analysis (Scanning):


The program is broken into tokens—smallest meaningful elements like keywords,
operators, and identifiers.
Example:
Code: int x = 5; → Tokens: int, x, =, 5, ;

2. Syntax Analysis (Parsing):


Tokens are checked for grammar rules of the language. Errors like unmatched
brackets are detected, and a Parse Tree or AST is created.
Example:
Invalid: int x = ; → Syntax error: missing value.

3. Semantic Analysis:
Ensures logical correctness, such as type compatibility and proper usage of variables.
Example:
Invalid: Adding int to string → Error: incompatible types.

4. Intermediate Code Generation:


Translates source code into simplified, language-independent code.
Example:
Code: x = y + z → Intermediate: LOAD y, ADD z, STORE x.
5.

5. Optimization:
Improves efficiency by removing redundant instructions or calculations.
Example:
Calculating the same value twice → Optimized to calculate once and reuse.
6. Code Generation:
Converts optimized intermediate code into machine code, tailored to specific
hardware.
Example:
Intermediate: LOAD y → Machine code: MOV AX, Y.
2. Interpreters
An interpreter translates and executes a program one line at a time, making it
immediately runnable without waiting for full translation. However, this can
make interpreters slower compared to compilers.

1. Lexical Analysis (Scanning):


Scans the program line-by-line, breaking it into tokens (e.g., variables, operators, keywords) to
identify basic components.
Example:
Code: x = 10 + y → Tokens: x, =, 10, +, y.

2. Syntax and Semantic Analysis:


Checks each line's grammar and logical correctness simultaneously.
Example:
Code: x = "10" + 5 → Error: incompatible types detected and reported instantly.

3. Execution:
Executes each line immediately after processing.
Example:
Code: print("Hello") → Interpreter translates and displays: Hello.
3. Assemblers
An assembler converts programs written in assembly language into machine code.

Assembly language uses simple mnemonics like MOV, ADD, and symbols that are easier for

humans to understand than binary instructions.

1. Lexical Analysis (Scanning):


The assembler breaks assembly code into tokens to identify components such as
mnemonics, registers, and values.
Example:
Code: MOV AX, 5 → Tokens: MOV, AX, 5.
2. Syntax Analysis:
Verifies the correctness of instructions according to the processor’s rules, checking for
proper operands and structure.
Example:
Code: MOV AX → Error: missing source operand.
3. Machine Code Generation:
Translates mnemonics into binary instructions specific to the processor’s
architecture.
Example:
Code: MOV AX, 5 → Binary: 10110000 00000101.
Generations of Programming Languages
Programming languages have grown over time to make coding easier, faster, and more
useful. They are divided into five generations, with each bringing improvements. Below is a
summary of each generation with examples for adding two numbers.

1. First Generation (1GL): Machine Language


 What it is:
The very first programming language, written in binary code (0s and 1s), directly
executed by the computer.
 Improvement:
Works fast because it communicates directly with hardware.
 Limitation:
Very hard to write and understand. Each program only works on one specific machine.
 Example (Adding Two Numbers):
1. 10110000 00000001 ; Load 1 into AX
2. 10110000 00000010 ; Load 2 into BX
3. 00000001 00000001 ; Add BX to AX

2. Second Generation (2GL): Assembly Language


 What it is:
Uses mnemonics (words like ADD and MOV) instead of binary, making coding
slightly easier.
 Improvement:
Easier to read than machine language and uses human-friendly terms.
 Limitation:
Still specific to one machine.
 Example (Adding Two Numbers):
1. MOV AX, 5 ; Load 5 into AX
2. MOV BX, 3 ; Load 3 into BX
3. ADD AX, BX ; Add BX to AX

3. Third Generation (3GL): High-Level Languages


 What it is:
Languages like C, Python, and Java that use simple words and symbols. You can
write code without worrying about the hardware.
 Improvement:
Easier to learn and use. The same code can run on different computers (portable).
 Limitation:
Needs a compiler or interpreter to convert the code into machine language.
 Example in C (Adding Two Numbers):
1. #include <stdio.h>
2. int main() {
3. int a = 5, b = 3, sum;
4. sum = a + b;
5. printf("Sum: %d\n", sum);
6. return 0;
7. }

4. Fourth Generation (4GL): Declarative Languages


 What it is:
Languages like SQL focus on describing what you want to do instead of how to do it.
Great for specific tasks like managing databases.
 Improvement:
Fewer lines of code are needed to perform tasks.
 Limitation:
Limited to specific areas like data or calculations.
 Example in SQL (Adding Two Numbers):
1. SELECT 5 + 3 AS sum;

5. Fifth Generation (5GL): AI-Based Languages


 What it is:
Languages like Prolog and Lisp used for logic-based tasks and artificial intelligence.
Instead of step-by-step coding, you describe the problem, and the program figures out
the solution.
 Improvement:
Useful for AI, robotics, and machine learning.
 Limitation:
Complex and not for regular programs.
 Example in Prolog (Adding Two Numbers):
1. sum(X, Y, Z) :- Z is X + Y.
2. ?- sum(5, 3, Result).
3. % Result = 8
Evolution of Programming Languages
Programming languages have changed a lot over the years because of better technology and
the need to make programming easier. From using simple machine codes to modern
programming tools, each stage has added new ways to make programming faster and
simpler.

1950s: Machine Code and Assembly Language


people used machine code (binary numbers) and assembly language to write programs. This
method was hard to understand and required knowing a lot about how the hardware worked.
The programs could only run on specific computers, which made it difficult to share or reuse
them.

1970s: Structured Programming


structured programming became popular with languages like C and Pascal. These languages
allowed programmers to organize their code better. Concepts like loops and functions made
it easier to write, fix, and update programs. Programmers didn’t need to worry about
hardware as much anymore.

1990s: Object-Oriented Programming


object-oriented programming (OOP) became a big deal with languages like Java and C++.
OOP introduced ideas like objects and classes, which made it easier to create software by
reusing code. Concepts like inheritance and polymorphism helped in building more complex
and efficient systems.

Today: Scripting and Modern Languages


scripting languages like Python, JavaScript, and Ruby are very popular. Python is widely
used for data science and AI because it is simple and powerful. JavaScript is a key tool for
building dynamic websites and web applications using modern frameworks. These languages
focus on making programming easier and solving real-world problems quickly.

This evolution shows how programming languages have improved to match the needs of
programmers and technology over time.
Challenges and Limitations of Translators
 Interpreted languages, like Python and JavaScript, run code one line at a time, making
them slower than compiled languages.
 Compiled languages, like C and C++, turn code into machine language beforehand,
making them run faster.
 Interpreted languages are easier for beginners to learn but may not be fast enough for big,
complex projects.
 Sometimes error messages don't clearly show where mistakes are in the code, which can
make it harder to fix.
 Errors in some languages don’t always tell you exactly where the mistake happened,
which can confuse beginners.
 Some compiled programs only work on certain computers or operating systems.
 Programs created on one computer (e.g., Windows) may not work on another without
making changes.
 While interpreted languages can run on many different systems, they need the right
software to work properly.
 Making sure a program works on different systems takes extra time, effort, and money.
 Ensuring a program works smoothly on all kinds of systems is tricky and requires a lot of
extra work.

Future Trends and Scope of Translators


AI in Translators

A big change in programming tools is using Artificial Intelligence (AI) in translators. AI can
make compilers smarter. Instead of just using old methods to improve code, AI can learn
from the code and make better choices. This can make compilers faster and save time for
developers. AI could even suggest ways to improve the code while you are writing it or fix
issues by itself during the compiling process. This could help beginners learn to code faster
and easier.

Cross-Language Compilation (Transpiling)

Another interesting trend is cross-language compilation, called transpiling. Transpilers are


tools that change code from one language to another. For example, a tool like Babel can
change new JavaScript code into older code so it works on older browsers.

Cloud-Based Translators and IDEs

Another new idea is using cloud-based compilers and Integrated Development Environments
(IDEs). These cloud tools will let developers write, compile, and test code without installing
any software. This can make coding easier for more people. Cloud-based IDEs will also let
developers work together in real time on the same project, no matter where they are.

You might also like