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

Verma 22222222

Uploaded by

wihac37243
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)
45 views13 pages

Verma 22222222

Uploaded by

wihac37243
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/ 13

Programming Language

communicate with a person, we need a specific language, similarly to communicate with


computers, programmers also need a language is called Programming language.

What is Language?

Language is a mode of communication that is used to share ideas, opinions with each other.
For example, if we want to teach someone, we need a language that is understandable by both
communicators.

What is a Programming Language?

A programming language is a computer language that is used by programmers (developers)


to communicate with computers. It is a set of instructions written in any specific language (
C, C++, Java, Python) to perform a specific task.

A programming language is mainly used to develop desktop applications, websites, and


mobile applications.

A programming language is a formal language that specifies a set of instructions for a


computer to perform specific tasks. It’s used to write software programs and applications,
and to control and manipulate computer systems. There are many different programming
languages, each with its own syntax, structure, and set of commands. Some of the most
commonly used programming languages include Java, Python, C++, JavaScript, and C#. The
choice of programming language depends on the specific requirements of a project, including
the platform being used, the intended audience, and the desired outcome. Programming
languages continue to evolve and change over time, with new languages being developed and
older ones being updated to meet changing needs.

Most Popular Programming Languages –


• C
• Python
• C++
• Java
• SCALA
• C#
• R
• Ruby
• Go
• Swift
• JavaScript

Basic Terminologies in Programming Languages:


• Algorithm: A step-by-step procedure for solving a problem or performing a task.
• Variable: A named storage location in memory that holds a value or data.
• Data Type: A classification that specifies what type of data a variable can hold, such as
integer, string, or boolean.
• Function: A self-contained block of code that performs a specific task and can be called
from other parts of the program.
• Control Flow: The order in which statements are executed in a program, including loops
and conditional statements.
• Syntax: The set of rules that govern the structure and format of a programming language.
• Comment: A piece of text in a program that is ignored by the compiler or interpreter,
used to add notes or explanations to the code.
• Debugging: The process of finding and fixing errors or bugs in a program.
• IDE: Integrated Development Environment, a software application that provides a
comprehensive development environment for coding, debugging, and testing.
• Operator: A symbol or keyword that represents an action or operation to be performed
on one or more values or variables, such as + (addition), – (subtraction), *
(multiplication), and / (division).

Types of programming language

1. Low-level programming language

Low-level language is machine-dependent (0s and 1s) programming language. The processor
runs low- level programs directly without the need of a compiler or interpreter, so the programs
written in low-level language can be run very fast.

Low-level language is further divided into two parts -

i. Machine Language

Machine language is a type of low-level programming language. It is also called as machine


code or object code. Machine language is easier to read because it is normally displayed in
binary or hexadecimal form (base 16) form. It does not require a translator to convert the
programs because computers directly understand the machine language programs.

The advantage of machine language is that it helps the programmer to execute the programs
faster than the high-level programming language.

ii. Assembly Language

Assembly language (ASM) is also a type of low-level programming language that is designed
for specific processors. It represents the set of instructions in a symbolic and human-
understandable form. It uses an assembler to convert the assembly language to machine
language.

The advantage of assembly language is that it requires less memory and less execution time to
execute a program.
2. High-level programming language

High-level programming language (HLL) is designed for developing user-friendly software


programs and websites. This programming language requires a compiler or interpreter to
translate the program into machine language (execute the program).

The main advantage of a high-level language is that it is easy to read, write, and maintain.

High-level programming language includes Python, Java, JavaScript, PHP, C#, C++,
Objective C, Cobol, Perl, Pascal, LISP, FORTRAN, and Swift programming language.

A high-level language is further divided into three parts -

i. Procedural Oriented programming language

Procedural Oriented Programming (POP) language is derived from structured programming


and based upon the procedure call concept. It divides a program into small procedures
called routines or functions.

Procedural Oriented programming language is used by a software programmer to create a


program that can be accomplished by using a programming editor like IDE, Adobe
Dreamweaver, or Microsoft Visual Studio.

The advantage of POP language is that it helps programmers to easily track the program flow
and code can be reused in different parts of the program.

The advantage of POP language is that it helps programmers to easily track the program flow
and code can be reused in different parts of the program.

Example: C, FORTRAN, Basic, Pascal, etc.

ii. Object-Oriented Programming language

Object-Oriented Programming (OOP) language is based upon the objects. In


this programming language, programs are divided into small parts called objects. It is
used to implement real-world entities like inheritance, polymorphism, abstraction, etc in the
program to makes the program resusable, efficient, and easy-to-use.

The main advantage of object-oriented programming is that OOP is faster and easier to execute,
maintain, modify, as well as debug.

Note: Object-Oriented Programming language follows a bottom-up approach.

Example: C++, Java, Python, C#, etc.

iii. Natural language

Natural language is a part of human languages such as English, Russian, German, and
Japanese. It is used by machines to understand, manipulate, and interpret human's language. It
is used by developers to perform tasks such as translation, automatic summarization,
Named Entity Recognition (NER), relationship extraction, and topic segmentation.

The main advantage of natural language is that it helps users to ask questions in any subject
and directly respond within seconds.

3. Middle-level programming language

Middle-level programming language lies between the low-level programming language and
high-level programming language. It is also known as the intermediate programming
language and pseudo-language.

A middle-level programming language's advantages are that it supports the features of high-
level programming, it is a user-friendly language, and closely related to machine language and
human language.

Example: C, C++, language

Advantages of programming languages:

1. Increased Productivity: Programming languages provide a set of abstractions that


allow developers to write code more quickly and efficiently.
2. Portability: Programs written in a high-level programming language can run on many
different operating systems and platforms.
3. Readability: Well-designed programming languages can make code more readable and
easier to understand for both the original author and other developers.
4. Large Community: Many programming languages have large communities of users
and developers, which can provide support, libraries, and tools.

Disadvantages of programming languages:

1. Complexity: Some programming languages can be complex and difficult to learn,


especially for beginners.
2. Performance: Programs written in high-level programming languages can run slower
than programs written in lower-level languages.
3. Limited Functionality: Some programming languages may not have built-in support
for certain types of tasks or may require additional libraries to perform certain functions.
4. Fragmentation: There are many different programming languages, which can lead to
fragmentation and make it difficult to share code and collaborate with other developers.

2).Syntactic and Semantic:

What is Syntax?

The syntax of computer programming language is utilized to represent the structure of


programs without viewing their meaning. It mainly focuses on the structure and arrangement
of a program with the help of its appearance. It consists of a set of rules and regulations that
validates the sequence of symbols and statements that are utilized in a program. Both human
languages and programming languages rely on syntax, and the pragmatic and computation
model represents these syntactic elements of a computer programming language.

Use of grammar in Syntax

Usually, grammar is rewriting rules whose aim is to recognize and make programs. Grammar
doesn't rely on the computation model but rather on the description of the language's structure.
The grammar includes a finite number of grammatical categories (including noun phrases,
articles, nouns, verb phrases, etc.), single words (alphabet elements), and well-formed rules
that govern the order in which the grammatical categories may appear.

Techniques of Syntax

There are several formal and informal techniques that may help to understand the syntax of
computer programming language. Some of those techniques are as follows:

1. Lexical Syntax

It is utilized to define basic symbols' rules, including identifiers, punctuators, literals, and
operators.

2. Concrete Syntax

It describes the real representation of programs utilizing lexical symbols such as their alphabet.

3. Abstract Syntax

It communicates only the essential program information.

How do you prevent a syntax error?

Syntax errors occur when a command is typed incorrectly in a command line or when a bug is
discovered in a program or script. The command or code should be written without any syntax
errors to avoid syntax errors.

What are Semantics?

Semantics is a linguistic concept that differs from syntax. In a computer programming


language, the term semantics is utilized to determine the link between the model of computation
and the syntax. The concept behind semantics is that linguistic representations or symbols
enable logical outcomes because a collection of words and phrases communicates ideas to
machines and humans. The syntax-directed semantics approach is utilized to map syntactical
concepts to the computational model via a function.
Techniques of Semantics

There are several techniques that may help to understand the semantics of computer
programming language. Some of those techniques are as follows:

1. Algebraic semantics

It analyzes the program by specifying algebra.

2. Operational Semantics

After comparing the languages to the abstract machine, it evaluates the program as a series of
state transitions.

3. Translational Semantics

It mainly concentrates on the methods that are utilized for translating a program into another
computer language.

4. Axiomatic Semantics

It specifies the meaning of a program by developing statements about an establishment that


detain at every stage of the program's execution.

5. Denotational Semantics

It represents the meaning of the program by a set of functions that work on the program state.

Types of Semantics

There are several types of semantics. Some of those are as follows:

1. Formal Semantics

Words and meanings are analyzed philosophically or mathematically in formal semantics. It


constructs models to help define the truth behind words instead of considering only real-world
instances.

2. Lexical Semantics

It is the most well-known sort of semantics. It searches for the meaning of single words by
taking into consideration the context and text surrounding them.

3. Conceptual Semantics

The dictionary definition of the word is analyzed before any context is applied in conceptual
semantics. After examination of the definition, the context is explored by searching for linking
terms, how meaning is assigned, and how meaning may change over time. It can be referred to
as a sign that the word conveys context.
here are various key differences between Syntax and Semantics. Some of the key differences
between Syntax and Semantics are as follows:

1. The rules and regulations that help write any statement in any programming language
are known as syntax. In contrast, Semantics defines the meaning of the related line of
code in a programming language.
2. Syntax errors occur after the execution of the program. In contrast, semantic errors
occur at the runtime of the program.
3. Some syntax errors are simple and easy to find. On the other hand, Semantic errors are
complex to detect.
4. The syntax of a computer programming language is linked to its grammar and structure.
On the other hand, semantics is related to a line of code in a programming language.
5. The syntax is the arrangement or order of words that are defined by the writer's style as
well as grammar rules. In contrast, logical semantics and lexical semantics are two
branches of semantics.
6. In most programming languages, the syntax is sensitive. In contrast, most semantics are
case-insensitive.

Features Syntax Semantics

Definition It is a program's structure written in a computer It defines the meaning of a


programming language. programming language's related line
of code.

Basic It allowed phrases of a language. It refers to the interpretation of the


phrases.

Relation The meaning of syntax interpretation should be A syntactic form is linked with a
unique. semantic component.

Errors Its errors are handled at the compile time. Semantic errors are confronted at
runtime.

Finding Syntax errors are easy to find. Semantic errors are complex to find.
Errors

Sensitivity It is sensitive in most computer programming It is case-insensitive in some cases.


languages.

In It is the arrangement or order of words that is Logical semantics and lexical


linguistics determined by the writer's style as well as semantics are two branches of
grammar rules. semantics.

Conclusion
A programming language's syntax is a group of rules that control the structure or form of code.
In contrast, semantics is the interpretation of the code or the associated sense of symbols,
letters, or any other aspect of a program.

3) Characteristics of Programming Languages:

1. Evolution and Updates

Adaptability to evolving industry trends is key. A good programming language undergoes


regular updates and enhancements to stay relevant, incorporating new features and
improvements.

2. Clarity and Readability

One of the primary characteristics is the clarity and readability of the language. A good
programming language should have syntax and structure that are easy to understand, reducing
the chances of errors and enhancing collaboration among developers.

3. Efficiency and Performance

Efficiency is a cornerstone of programming languages. A language should allow developers to


write code that executes quickly and consumes minimal system resources. This ensures
optimal performance of applications developed in that language.

4. Flexibility and Versatility

Versatility is vital for a programming language to cater to various application domains. A


good language should be flexible enough to adapt to different paradigms, allowing developers
to use it for a wide array of projects.

5. Community Support

A thriving community is a testament to the language’s popularity and support. A good


programming language should have an active community that contributes to its growth,
provides solutions to issues, and shares knowledge.
6. Security Measures

Security is a paramount concern in the digital age. A good programming language


incorporates built-in security features to help developers create robust and secure applications,
protecting user data and preventing vulnerabilities.

7. Scalability

Scalability is crucial for languages used in large-scale applications. A good programming


language should facilitate the development of scalable solutions, ensuring they can handle
increased workloads without compromising performance.

8. Ease of Learning

Accessibility is key. A good programming language should have a gentle learning curve,
allowing newcomers to grasp the basics quickly. This promotes a wider adoption of the
language and encourages a diverse developer community.

9. Documentation

Comprehensive and user-friendly documentation is indispensable. Good programming


languages provide extensive documentation that guides developers through various aspects,
from installation to advanced features, promoting efficient use.

10. Consistency

Consistency in syntax and behavior across the language is essential. It ensures that developers
can predict how code will behave, fostering a smoother development process and reducing
debugging time.
11. Compatibility

Interoperability with other languages and systems is a valuable characteristic. A good


programming language should allow seamless integration with existing codebases and
technologies, promoting collaboration and reuse of resources.

12. Error Handling

Effective error handling is crucial for identifying and resolving issues in a timely manner. A
good programming language provides robust mechanisms for error detection and graceful
recovery.

13. Abstraction

Abstraction simplifies complex concepts, making them more manageable. A good


programming language should offer abstraction mechanisms that enable developers to work at
higher levels without getting bogged down by unnecessary details.

14. Interoperability

Interoperability fosters collaboration between different technologies. A good programming


language should support interoperability, allowing developers to use libraries and components
from other languages seamlessly.

15. Evolution and Updates

Adaptability to evolving industry trends is key. A good programming language undergoes


regular updates and enhancements to stay relevant, incorporating new features and
improvements.
4)Translator:

1- It is a software that accept the source code ,written in any programming language and
convert it into target language for which it is developed.
2- Translator also detect and report error during translation.
3- Different types of translator are as follow-:
(a-) Assembler
(b-) compiler
(c-) Interpreter

Compiler ,Interpreter and Assembler

Compiler

The language processor that reads the complete source program written in high-level
language as a whole in one go and translates it into an equivalent program in machine
language is called a Compiler. Example: C, C++, C#.
In a compiler, the source code is translated to object code successfully if it is free of errors.
The compiler specifies the errors at the end of the compilation with line numbers when there
are any errors in the source code. The errors must be removed before the compiler can
successfully recompile the source code again the object program can be executed number of
times without translating it again.

Assembler
The Assembler is used to translate the program written in Assembly language into machine
code. The source program is an input of an assembler that contains assembly language
instructions. The output generated by the assembler is the object code or machine code
understandable by the computer. Assembler is basically the 1st interface that is able to
communicate humans with the machine. We need an assembler to fill the gap between human
and machine so that they can communicate with each other. code written in assembly
language is some sort of mnemonics(instructions) like ADD, MUL, MUX, SUB, DIV, MOV
and so on. and the assembler is basically able to convert these mnemonics in binary code.
Here, these mnemonics also depend upon the architecture of the machine.
For example, the architecture of intel 8085 and intel 8086 are different.
Interpreter
The translation of a single statement of the source program into machine code is done by a
language processor and executes immediately before moving on to the next line is called an
interpreter. If there is an error in the statement, the interpreter terminates its translating
process at that statement and displays an error message. The interpreter moves on to the next
line for execution only after the removal of the error. An Interpreter directly executes
instructions written in a programming or scripting language without previously converting
them to an object code or machine code. An interpreter translates one line at a time and then
executes it.
Example: Perl, Python and Matlab.

Difference Between Compiler and Interpreter


Compiler Interpreter

A compiler is a program that converts the entire An interpreter takes a source program
source code of a programming language into and runs it line by line, translating each
executable machine code for a CPU. line as it comes to it.

The compiler takes a large amount of time to An interpreter takes less amount of
analyze the entire source code but the overall time to analyze the source code but the
execution time of the program is comparatively overall execution time of the program
faster. is slower.

The compiler generates the error message only


Its Debugging is easier as it continues
after scanning the whole program, so debugging
translating the program until the error
is comparatively hard as the error can be present
is met.
anywhere in the program.

It requires less memory than a


The compiler requires a lot of memory for
compiler because no object code is
generating object codes.
generated.

No intermediate object code is


Generates intermediate object code.
generated.

The interpreter is a little vulnerable in


For Security purpose compiler is more useful.
case of security.
Compiler Interpreter

Examples: Python, Perl, JavaScript,


Examples: C, C++, C#
Ruby.

5) Data Types:


Each variable in C has an associated data type. It specifies the type of data that the
variable can store like integer, character, floating, double, etc. Each data type requires
different amounts of memory and has some specific operations which can be
performed over it. The data type is a collection of data with values having fixed
values, meaning as well as its characteristics.
The data types can be classified as follows:
Types Description

Primitive data types are the most basic data types that are used
Primitive Data
for representing simple values such as integers, float, characters,
Types
etc.

User Defined
The user-defined data types are defined by the user himself.
Data Types

The data types that are derived from the primitive or built-in
Derived Types
datatypes are referred to as Derived Data Types.

You might also like