Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Concepts of Programming Languages Lecturer: Dr. Emad Nabil Lecture # 2."— Presentation transcript:

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

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

3 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)

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

5 Copyright © 2012 Addison-Wesley. All rights reserved.1-5 1-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

6 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.

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

8 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

9 Copyright © 2012 Addison-Wesley. All rights reserved.1-9 3. 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

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

11 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.

12 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

13 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


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

Similar presentations


Ads by Google