Programming Fundamentals 1 - Unit 3: Compiled v. Interpreted Languages

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Interpreters - difference between Virtual Machine (modern day interpreters)

Interpreters operate dynamically-typed languages which require a type determination at runtime. Whereas, Virtual Machines work with statically-typed languages & therefore do not have to determine type at runtime. (Interpreters preform more complex analysis than Virtual Machines)

Combinations & Variations

It SHOULD be noted that most languages can be EITHER Compiled or Interpreted.

JIT(Just In Time) Compilers - processing speed

JIT COMPILATION SYSTEMS are typically FASTER than interpreters, especially when working with large programs. (that means that the program COMPILES FASTER with JIT)

JIT(Just In Time) Compilers - Whats so special 'bout it?

JIT compilers are also known as Dynamic Compilers since the compilation process occurs at runtime (at least the 1st time)

One of the 1st attributes discussed about any modern computing language is ...

... whether the computing language is compiled or interpreted.

Interpreters - Virtual Machines

A Virtual Machine emulates a physical machine (the computer) & is essentially a program to run the original program (Python program)

Interpreters - how the Python Virtual Machine interprets bytecode

As it applies to Python, the bytecode compiler generates code objects which contain bytecode. The PVM interprets the bytecode line-by-line

Combinations & Variations - miscellaneous/ academic reasons

Compilers have been produced from languages that are generally considered interpreted, and interpreters have been written for languages that are traditionally compiled. There is no general reason or benefit for doing this, unless it is an Academic exercise or a miscellaneous doing.

Interpreters - bytecode files nomenclature

For Python, bytecode files are named .pyc; For Java its .class, and for .NET is .exe. In the case of Java & .NET, the Virtual Machine in those languages contain and use a JIT compiler

Interpreters - programs with and without import statements

For programs WITHOUT import statements: Bytecode Compiler translates program to bytecode and STORES the results in MEMORY For programs WITH import statements: Bytecode Compiler translates program to bytecode and produces a BYTECODE FILE, then the PVM reads the bytecode FROM that FILE

Interpreters - Bytecode compilation & PVM interpretation for programs w/o import statements

For programs without import statements, the bytecode compiler preforms the translation to bytecode & stores the result in memory

JIT(Just In Time) Compilers - speed comparison

However traditionally compiled PROGRAMS are still FASTER than those programs compiled by the JIT compiler, since the former are designed to OPTIMIZE CODE though compilation might take longer JIT Compilers Traditional Compilation process: faster comp. slower comp. programs: not optimized optimized (might be slower) (faster)

Interpreters - the modern era

However, modern 'interpreted' languages like Python, use a bytecode compiler to first produce bytecode that is then processed by a Virtual Machine (VM a.k.a. interpreter, runtime).

Bytecode Compilers - What if a program imports modules

If the program imports modules, the bytecode compiler stores the bytecode in a .pyc file.

Bytecode Compilers - In the case of Python

In the case of Python, the bytecode compiler stores bytecode in memory & the interpreter runs the bytecode line-by-line

The differences between compiled and interpreted; then and now...

In the early days of computing, these terms were well defined and separate of each other; bit as time progressed, many computing languages have had a mix of both compiled and interpreted aspects. You can even construct a compiler or an interpreted for and from any language.

Interpreters - Bytecode compilation & PVM interpretation for programs WITH import statements

On the other hand, for programs with an import statement, the bytecode compiler is used to produce a bytecode file and the PVM reads the bytecode from that file

Interpreters - the good 'ol days

Originally, an interpreter compiled source code directly line-by-line & ran the instructions line-by-line. Ex: BASIC & Smalltalk (old computing languages)

JIT(Just In Time) Compilers - Examples

Some Dynamically Compiled languages are: C#, Java, Java Script, Python, PHP, Ruby & VB.NET

Interpreters - Examples

Some examples of Interpreted languages are: JavaScript, PHP, Python & Ruby.

Traditional Compilers - Examples

Some examples of Statically Compiled languages are : Ada, C, C++, COBOL, FORTRAN, & LISP.

Traditional Compilers - Requirements

The .exe file produced by the Traditional Compiler can be seen on a specific platform (ex: operating system) Ex: A .exe file compiled on a Windows machine can be copied to any Windows machine with the same operating system(in this case Windows) and the .exe will run on that machine

Bytecode Compilers - what happens to the bytecode?

The bytecode produced by the Bytecode Compiler is then processed by either an interpreted (line-by-line) or a JIT compiler (in many sections or rarely in whole programs)

JIT(Just In Time) Compilers - how often does the process occur?

The first time a program is run, that compilation process occurs (usually in sections of code). However, once converted from bytecode to machine code that file is stored and additional compilation are not required UNLESS the SOURCE CODE or the BYTECODE is CHANGED.

JIT(Just In Time) Compilers

These compilers convert bytecode to machine code 'at runtime'.

Bytecode Compilers

These compilers convert code into bytecode.

Traditional Compilers - code optimization

These compilers produce faster CODE than JIT compilers since Traditional Compilers are also designed to OPTIMIZE CODE.

Traditional Compilers - Whats so special 'bout it?

Traditional Compilers are also known as Static Compilers since the compilation process happens entirely before & independently of runtime.

Traditional Compilers - What do they do?

Traditional Compilers are those that produce stand-alone executable (.exe a.k.a. machine code) from source code. Source Code --AOT--> Machine code(.exe) After the .exe is produced, that file can be run directly by 2 x clicking, from the run prompt, or command line.

Traditional Compilers - Whats the difference?

Unlike Java, .NET, and Python programs, no additional runtime environment is required to run .exe's produced by a Traditional Compiler (that means no Virtual Machines, or anything like such, are needed)

Traditional Compilers - difference between it and JIT

Unlike the JIT compiler, which compiles at runtime, traditional compilation occurs at compile time (BEFORE runtime)

Combinations & Variations - compiled or interpreted? Which one is better?

Whether a language is compiled or interpreted is, strictly speaking, DEPENDENT of the PARTICULAR IMPLEMENTATION

Traditional Compilers

a.k.a. Ahead of Time (AOT) Compilers compile PRIOR to runtime


संबंधित स्टडी सेट्स

Chapter 1: Constitutional Democracy

View Set

Y7 Computing Key Words, Definitions & Questions

View Set

The Watsons Go To Birmingham ch 1 - 5 Questions

View Set

Chapter 11: Growth and Development: Infancy Through Adolescence

View Set

Module 1: Introduction to Operations Management

View Set

Individual Differences - The Flynn Effect

View Set

Health exam 3 (STRESS, STD, SLEEP)

View Set

Chapter 4 the developing person psychology

View Set

CM CERTIFICATION TRAINING REVIEW

View Set