Concepts of Programming Languages Lecturer: Dr. Emad Nabil Lecture # 2.

Slides:



Advertisements
Similar presentations
Chapter 1: Preliminaries
Advertisements

ISBN Chapter 1 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Motivation Programming Domains.
ISBN Chapter 1 Preliminaries. Copyright © 2007 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
CS 354 Overview. Copyright © 2007 Addison-Wesley. All rights reserved. 1–2 Course Topics What is a programming language? What features do programming.
ISBN Chapter 1 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
ISBN Lecture 01 Preliminaries. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.1-2 Lecture 01 Topics Motivation Programming.
Lecture 2 Concepts of Programming Languages
ISBN Chapter 1 Topics Motivation Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 INTRODUCTION "When the only tool you have is a hammer, everything looks like a nail" (Abraham.
Copyright © 1998 by Addison Wesley Longman, Inc. 1 Concepts of Programming Languages Chapter 1.
ISBN Chapter 1 Preliminaries. Copyright © 2007 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries. Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of Programming Languages.
ISBN Chapter 1 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved. 1-2 Chapter 1 Topics Reasons for Studying Concepts of.
CS 355 – Programming Languages
Chapter 1 Preliminaries CS Concepts of Programming Languages.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages.
Copyright © 2007 Addison-Wesley. All rights reserved.1-1 Reasons for Studying Concepts of Programming Languages Increased ability to express ideas Improved.
ICS 313 Fundamentals of Programming Languages Instructor: Abdul Wahid Wali Lecturer, CSSE, UoH
ISBN Chapter 1 Preliminaries. Corrected and improved by Assoc. Prof. Zeki Bayram, EMU, North Cyprus. Original Copyright © 2007 Addison-Wesley.
ISBN CS 354 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Course Topics What is a programming language? What features.
ISBN Chapter 1 Preliminaries. Copyright © 2015 Pearson. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of Programming.
ISBN Chapter 1 Preliminaries. Copyright © 2009 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
ISBN Chapter 1 Preliminaries. 1-2 Chapter 1 Preliminaries 1.1 Reasons for Studying Concepts of Programming Languages 1.2 Programming Domains.
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
Chapter 1 Preliminaries. Copyright © 2017 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of Programming Languages.
ISBN Chapter 1 Preliminaries. Copyright © 2006 Addison-Wesley. All rights reserved.1-2 Chapter 1 Topics Reasons for Studying Concepts of.
INTRODUCTION "When the only tool you have is a hammer, everything looks like a nail" (Abraham Maslow) Copyright © 2006 Addison-Wesley. All rights reserved.
Concepts of Programming Languages
Chapter 1 Preliminaries.
Why study programming languages?
Chapter 1 Preliminaries.
Language Translation Compilation vs. interpretation.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
PROGRAMMING LANGUAGES
Chapter 1 Reasons to study concepts of PLs Programming Domains
1.1 Reasons to study concepts of PLs
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Introduction.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Lecture 2 Concepts of Programming Languages
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Reasons To Study Programming Languages
Chapter 1 Preliminaries.
Lecture 2 Concepts of Programming Languages
Chapter 1 Preliminaries.
Chapter 1 Preliminaries.
Presentation transcript:

Concepts of Programming Languages Lecturer: Dr. Emad Nabil Lecture # 2

Copyright © 2012 Addison-Wesley. All rights reserved.1-2 Programming Languages Implementation Methods 1.Compilation 2.Pure Interpretation 3.Hybrid Implementation Systems

Copyright © 2012 Addison-Wesley. All rights reserved.1-3 Programming Languages Implementation Methods 1.Compilation –Programs are translated into machine language –  such as C, COBOL, C++, and Ada, –Use: Large commercial applications 2.Hybrid Implementation Systems –A compromise between compilers and pure interpreters –Used when efficiency is not the first concern -  (Java,.NET languages)

Copyright © 2012 Addison-Wesley. All rights reserved Compilation Translate high-level program (source language)  into machine code (machine language) Slow translation means fast execution (why?) –Ans: Code optimization takes time.

Copyright © 2012 Addison-Wesley. All rights reserved Compilation Compilation process has several phases: –lexical analysis: converts characters in the source program into lexical units –syntax analysis: transforms lexical units into parse trees which represent the syntactic structure of program –Semantics analysis: generate intermediate code –code generation: machine code is generated

Copyright © 2012 Addison-Wesley. All rights reserved.1-6 Additional Compilation Terminologies The process of collecting system programs and linking them to user programs is called  linking and loading, or sometimes just inking. It is accomplished by a systems program called a linker.

1.Compilation 2.Hybrid Implementation Systems Compiler + JIT Compiler

2. Hybrid Implementation Compiler + JIT Just-in-time (JIT) compilation, also known as dynamic translation, is compilation done during execution of a program – at run time – rather than prior to execution. This consists of translation to machine code, which is then executed directly. Copyright © 2012 Addison-Wesley. All rights reserved.1-8

Copyright © 2012 Addison-Wesley. All rights reserved Hybrid Implementation Systems Just-in-Time Implementation Systems Initially translate programs to an intermediate language  Then compile the intermediate language of the subprograms into machine code when they are called. Machine code version is kept for subsequent (later) calls, each method is translated into M/C only when called. JIT systems are widely used for Java programs (byte code).NET languages are implemented with a JIT system (.NET Common Intermediate Language (CIL) In essence, JIT systems are delayed compilers JIT

Copyright © 2012 Addison-Wesley. All rights reserved Hybrid Implementation Systems Just-in-Time Implementation Systems

Copyright © 2012 Addison-Wesley. All rights reserved.1-11 Preprocessors in programming languages A preprocessor is a program that processes a program immediately before the program is compiled. Instructions to be used by the Preprocessor are embedded in programs. Like #include The preprocessor is essentially a macro expander. #include, #define Preprocessor instructions are commonly used to specify that the code from another file is to be included.

Copyright © 2012 Addison-Wesley. All rights reserved.1-12 Programming Environments A collection of tools used in software development Microsoft Visual Studio.NET –A large, complex visual environment –Used to build Web applications and non-Web applications in any.NET language NetBeans –Related to Visual Studio.NET, except for applications in Java

The study of programming languages is valuable for a number of reasons: Increase our capacity to use different constructs Enable us to choose languages more intelligently Makes learning new languages easier Most important criteria for evaluating programming languages include: Readability, writability, reliability, cost Major influences on language design have been machine architecture and software development methodologies The major methods of implementing programming languages are: compilation, and hybrid implementation Summary