Verma 22222222
Verma 22222222
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.
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.
i. Machine Language
The advantage of machine language is that it helps the programmer to execute the programs
faster than the high-level programming 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
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.
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.
The main advantage of object-oriented programming is that OOP is faster and easier to execute,
maintain, modify, as well as debug.
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.
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.
What is 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
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.
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
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
5. Denotational Semantics
It represents the meaning of the program by a set of functions that work on the program state.
Types of Semantics
1. Formal Semantics
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.
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
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.
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.
5. Community Support
7. Scalability
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
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
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
14. Interoperability
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
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.
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.
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.