PREPARED BY ,
Asst.Prof.M.Gokilavani,
BIET
9/28/2022 1
 Preliminary Concepts: Reasons for Studying Concepts of
Programming Languages, Programming Domains
 Language Evaluation Criteria, Influences on Language
Design, Language Categories, Language Design Trade-
Offs
 Implementation Methods, Programming Environments
 Syntax and Semantics: General Problem of Describing
Syntax and Semantics,
 Formal Methods of Describing Syntax
 Attribute Grammars, Describing the Meanings of Programs.
9/28/2022 2
Two Major Influences on Language Design
• Computer Architecture
• Languages are developed around the prevalent computer
architecture, known as the von Neumann architecture
• Programming Methodologies
• New software development methodologies (e.g., object oriented
software development) led to new programming paradigms and by
extension, new programming languages. are Design and
Engineering Approaches
• Well-known computer architecture: Von Neumann
• Imperative languages, most dominant, because of von
Neumann computers
 – Data and programs stored in memory
 – Memory is separate from CPU
 – Instructions and data are piped from memory to
CPU
 – Basis for imperative languages
 Variables model memory cells
 Assignment statements model piping
 Iteration is efficient
 Computer architecture in based on Von Neumann Architecture.
 A programming language is also affected by the architecture of
computer.
 But how ?
 This is the question will see here. When we deploy/run a
programs it reside in a memory and executed by the CPU.
 There are registers like program counter, instruction register
etc. Each instruction going from memory to CPU is decided
by program counter.
 And program counter get instruction info from instruction
register.
 In this a way a program developed in languages passes trough
this kind of cycle. Which affect the execution time of the
language.
 If system is multi user it will consume lot of time.
 Structured programming: This programming
methodology also called top own design and step wise
refinement. Its deficiency was incompleteness of type
checking and inadequacy of control statements, which
requires extensive use of go to statements. Ex. C.
 Data oriented programming: It focuses on data oriented
methods emphasize data design, focusing on the use of
abstract data types to solve the problem. Ex. Simula.
 Procedure oriented programming: It is the opposite of
data oriented programming. Ex. C#.
 Object oriented programming: It gives support for Data
abstraction, inheritance, polymorphism. Ex. C++.
• Imperative Language
– Central features are variables, assignment statements, and iteration
– Examples: C, Pascal
• Functional Language
– Main means of making computations is by applying functions to given
parameters
– Examples: LISP, Scheme
• Logic (declarative) Language
– Rule-based (rules are specified in no particular order)
– Example: Prolog
• Object-oriented Language
– Data abstraction, inheritance, late binding
– Examples: Java, C++
• Markup Language
– New; not a programming per se, but used to specify the layout of
information in Web Documents – Examples: XHTML, XML
Reliability vs. cost of execution
 – Conflicting criteria
 – Example: Java demands all references to array elements be
checked for proper indexing but that leads to increased execution
costs
Readability vs. Writability
 – Another conflicting criteria
 – Example: APL provides many powerful operators (and a large
number of new symbols), allowing complex computations to be
written in a compact program but at the cost of poor readability.
Writability (flexibility) vs. reliability
 – Another conflicting criteria
 – Example: C++ pointers are powerful and very flexible but not
reliably used
We have three different types of implementation methods
They are
• Compilation– Programs are translated into machine
language
• Pure Interpretation – Programs are interpreted by
another program known as an interpreter
• Hybrid Implementation Systems – A compromise
between compilers and pure interpreters
 Programs can be translated into machine language, which can be
executed directly on the computer. This method is called a
compiler implementation and has the advantage of very fast
program execution, once the translation process is complete.
Example: C, COBOL, and C++, are by compilers.
 Phase 1: The language that a compiler translates is called the
source language. The process of compilation and program
execution takes place in several phases, the most important of
which are shown in Figure.
 Phase 2: The lexical analyzer gathers the characters of the source
program into lexical units. The lexical units of a program are
identifiers, special words, operators, and punctuation symbols.
The lexical analyzer ignores comments in the source program
because the compiler has no use for them.
 Phase 3: The syntax analyzer takes the lexical units from the
lexical analyzer and uses them to construct hierarchical
structures called parse trees. These parse trees represent the
syntactic structure of the program.
 Phase 4: The intermediate code generator produces a
program in a different language, at an intermediate level
between the source program and the final output of the
compiler: the machine language program.
 Optimization, which improves programs (usually in their
intermediate code version) by making them smaller or faster
or both.
 The symbol table serves as a database for the
compilation process. The primary contents of the
symbol table are the type and attribute information of
each user- defined name in the program. This
information is placed in the symbol table by the
lexical and syntax analyzers and is used by the
semantic analyzer and the code generator.
 Phase 5: The code generator translates the optimized
intermediate code version of the program into an
equivalent machine language program.
 Translation of source code line by line so that generates
errors line by line. If no errors in the code generates
object code. While interpretation it self user input will
be given.
• Immediate feedback about errors
• Slower execution
• Often requires more space
Used mainly for scripting languages
Example for interpreter is Dbase III plus
 A compromise between compilers and pure interpreters
 A high-level language program is translated to an
intermediate language that allows easy interpretation
 Faster than pure interpretation.
 Example for hybrid implementation is Java. Java is a
compiled interpreted language.
 A Just-in-Time (JIT) implementation system initially
translates programs to an intermediate language. Then,
during execution, it compiles intermediate language
methods into machine code when they are called.
 The machine code version is kept for subsequent calls. JIT
systems now are widely used for Java programs. Also, the
.NET languages are all implemented with a JIT system.
 A preprocessor is a program that processes a program just
before the program is compiled. Preprocessor instructions
are embedded in programs.
 The preprocessor is essentially a macro expander.
Preprocessor instructions are commonly used to specify that
the code from another file is to be included.
 For example, the C preprocessor instruction
causes the preprocessor to copy the contents of myLib.h into
the program at the position of the #include.
 Other preprocessor instructions are used to define symbols
to represent expressions. For example, one could use
 The collection of tools used in software development
 The old way used the console and independent tools
 – UNIX/Linux
 vi or emacs for editing
 compiler
 debugger
 Integrated Development Environments provide a
graphical interface to most of the
 necessary tools
• Eclipse
 – An integrated development environment for Java,
written in java
 – Support for other languages is also available
• Borland JBuilder, NetBeans
 – Other integrated development environments for Java
• Microsoft Visual Studio.NET
 – A large, complex visual environment
 – Used to program in C#, Visual BASIC.NET, Jscript,
J#, or C++
9/28/2022 24

Unit 1_Evaluation Criteria_session 3.pptx

  • 1.
  • 2.
     Preliminary Concepts:Reasons for Studying Concepts of Programming Languages, Programming Domains  Language Evaluation Criteria, Influences on Language Design, Language Categories, Language Design Trade- Offs  Implementation Methods, Programming Environments  Syntax and Semantics: General Problem of Describing Syntax and Semantics,  Formal Methods of Describing Syntax  Attribute Grammars, Describing the Meanings of Programs. 9/28/2022 2
  • 3.
    Two Major Influenceson Language Design • Computer Architecture • Languages are developed around the prevalent computer architecture, known as the von Neumann architecture • Programming Methodologies • New software development methodologies (e.g., object oriented software development) led to new programming paradigms and by extension, new programming languages. are Design and Engineering Approaches
  • 4.
    • Well-known computerarchitecture: Von Neumann • Imperative languages, most dominant, because of von Neumann computers  – Data and programs stored in memory  – Memory is separate from CPU  – Instructions and data are piped from memory to CPU  – Basis for imperative languages  Variables model memory cells  Assignment statements model piping  Iteration is efficient
  • 6.
     Computer architecturein based on Von Neumann Architecture.  A programming language is also affected by the architecture of computer.  But how ?  This is the question will see here. When we deploy/run a programs it reside in a memory and executed by the CPU.  There are registers like program counter, instruction register etc. Each instruction going from memory to CPU is decided by program counter.  And program counter get instruction info from instruction register.  In this a way a program developed in languages passes trough this kind of cycle. Which affect the execution time of the language.  If system is multi user it will consume lot of time.
  • 8.
     Structured programming:This programming methodology also called top own design and step wise refinement. Its deficiency was incompleteness of type checking and inadequacy of control statements, which requires extensive use of go to statements. Ex. C.  Data oriented programming: It focuses on data oriented methods emphasize data design, focusing on the use of abstract data types to solve the problem. Ex. Simula.  Procedure oriented programming: It is the opposite of data oriented programming. Ex. C#.  Object oriented programming: It gives support for Data abstraction, inheritance, polymorphism. Ex. C++.
  • 9.
    • Imperative Language –Central features are variables, assignment statements, and iteration – Examples: C, Pascal • Functional Language – Main means of making computations is by applying functions to given parameters – Examples: LISP, Scheme • Logic (declarative) Language – Rule-based (rules are specified in no particular order) – Example: Prolog • Object-oriented Language – Data abstraction, inheritance, late binding – Examples: Java, C++ • Markup Language – New; not a programming per se, but used to specify the layout of information in Web Documents – Examples: XHTML, XML
  • 10.
    Reliability vs. costof execution  – Conflicting criteria  – Example: Java demands all references to array elements be checked for proper indexing but that leads to increased execution costs Readability vs. Writability  – Another conflicting criteria  – Example: APL provides many powerful operators (and a large number of new symbols), allowing complex computations to be written in a compact program but at the cost of poor readability. Writability (flexibility) vs. reliability  – Another conflicting criteria  – Example: C++ pointers are powerful and very flexible but not reliably used
  • 11.
    We have threedifferent types of implementation methods They are • Compilation– Programs are translated into machine language • Pure Interpretation – Programs are interpreted by another program known as an interpreter • Hybrid Implementation Systems – A compromise between compilers and pure interpreters
  • 12.
     Programs canbe translated into machine language, which can be executed directly on the computer. This method is called a compiler implementation and has the advantage of very fast program execution, once the translation process is complete. Example: C, COBOL, and C++, are by compilers.  Phase 1: The language that a compiler translates is called the source language. The process of compilation and program execution takes place in several phases, the most important of which are shown in Figure.  Phase 2: The lexical analyzer gathers the characters of the source program into lexical units. The lexical units of a program are identifiers, special words, operators, and punctuation symbols. The lexical analyzer ignores comments in the source program because the compiler has no use for them.
  • 14.
     Phase 3:The syntax analyzer takes the lexical units from the lexical analyzer and uses them to construct hierarchical structures called parse trees. These parse trees represent the syntactic structure of the program.  Phase 4: The intermediate code generator produces a program in a different language, at an intermediate level between the source program and the final output of the compiler: the machine language program.  Optimization, which improves programs (usually in their intermediate code version) by making them smaller or faster or both.
  • 15.
     The symboltable serves as a database for the compilation process. The primary contents of the symbol table are the type and attribute information of each user- defined name in the program. This information is placed in the symbol table by the lexical and syntax analyzers and is used by the semantic analyzer and the code generator.  Phase 5: The code generator translates the optimized intermediate code version of the program into an equivalent machine language program.
  • 17.
     Translation ofsource code line by line so that generates errors line by line. If no errors in the code generates object code. While interpretation it self user input will be given. • Immediate feedback about errors • Slower execution • Often requires more space Used mainly for scripting languages Example for interpreter is Dbase III plus
  • 18.
     A compromisebetween compilers and pure interpreters  A high-level language program is translated to an intermediate language that allows easy interpretation  Faster than pure interpretation.  Example for hybrid implementation is Java. Java is a compiled interpreted language.  A Just-in-Time (JIT) implementation system initially translates programs to an intermediate language. Then, during execution, it compiles intermediate language methods into machine code when they are called.  The machine code version is kept for subsequent calls. JIT systems now are widely used for Java programs. Also, the .NET languages are all implemented with a JIT system.
  • 20.
     A preprocessoris a program that processes a program just before the program is compiled. Preprocessor instructions are embedded in programs.  The preprocessor is essentially a macro expander. Preprocessor instructions are commonly used to specify that the code from another file is to be included.  For example, the C preprocessor instruction causes the preprocessor to copy the contents of myLib.h into the program at the position of the #include.
  • 21.
     Other preprocessorinstructions are used to define symbols to represent expressions. For example, one could use
  • 22.
     The collectionof tools used in software development  The old way used the console and independent tools  – UNIX/Linux  vi or emacs for editing  compiler  debugger  Integrated Development Environments provide a graphical interface to most of the  necessary tools
  • 23.
    • Eclipse  –An integrated development environment for Java, written in java  – Support for other languages is also available • Borland JBuilder, NetBeans  – Other integrated development environments for Java • Microsoft Visual Studio.NET  – A large, complex visual environment  – Used to program in C#, Visual BASIC.NET, Jscript, J#, or C++
  • 24.