35
High-level Languages

High-level Languages

Embed Size (px)

DESCRIPTION

High-level Languages. Assembly language benefits. Hides details of hardware. Assembly language benefits. Hides details of hardware Easier to remember instruction names. Assembly language benefits. Hides details of hardware Easier to remember instruction names - PowerPoint PPT Presentation

Citation preview

Page 1: High-level Languages

High-level Languages

Page 2: High-level Languages

Assembly language benefits

Hides details of hardware

Page 3: High-level Languages

Assembly language benefits

Hides details of hardware

Easier to remember instruction names

Page 4: High-level Languages

Assembly language benefits

Hides details of hardware

Easier to remember instruction names

A tiny step closer to how humans think

Page 5: High-level Languages

Assembly language benefits

Hides details of hardware

Easier to remember instruction names

A tiny step closer to how humans think

Assembly language is a useful level of abstraction from the bare hardware

Page 6: High-level Languages

Assembly language benefits

Hides details of hardware

Easier to remember instruction names

A tiny step closer to how humans think

Assembly language is a useful level of abstraction from the bare hardware

Assembly language programs must be "assembled" into machine language executables.

Page 7: High-level Languages

Assembly Language issues

Still tied directly to the machine language instruction set

Page 8: High-level Languages

Assembly Language issues

Still tied directly to the machine language instruction set

Most machine language instructions do only a tiny amount of work

Page 9: High-level Languages

Assembly Language issues

Still tied directly to the machine language instruction set

Most machine language instructions do only a tiny amount of work

Humans solve problems at a higher level, using much larger steps

Page 10: High-level Languages

Example

For each value I read in from a fileIf the value is negative, then

add it to the list of expendituresOtherwise

add it to the list of income

(This is pseudo-code, like the way we write textual storyboards)

Page 11: High-level Languages

High-level languages

Def: a programming language that provides statements that are a closer match to the way humans solve problems than assembly language.

Why can't we just write programs in English (or any other spoken language)?

Page 12: High-level Languages

Examples

COBOL – business application languageFORTRAN – scientific application languageBASIC, Pascal – teaching languagesAda – designed and used for US military softwareSmalltalk – early object-oriented languageC, C++ - systems/general purpose languages

Page 13: High-level Languages

Can a program in a high-level language be executed on a computer?

Page 14: High-level Languages

High-level language translation

compiler – a program that translates a program written in a particular high level language into another form.

What form should a compiler output?

Page 15: High-level Languages

Compiled languages

High level languages that are translated into a machine language executable are called "compiled languages."

Executables might be called "native code."

Page 16: High-level Languages

HLL correspondence to AL

Benefit of HLL is being able to work in "bigger steps."

One HLL statement might translate to many AL/ML instructions

Page 17: High-level Languages

HLL correspondence to AL

Benefit of HLL is being able to work in "bigger steps."

One HLL statement might translate to many AL/ML instructions

sum = sum + value;

Java statement

Page 18: High-level Languages

HLL correspondence to AL

Benefit of HLL is being able to work in "bigger steps."

One HLL statement might translate to many AL/ML instructions

sum = sum + value;

Java statement Woody equivalent

CopyFrom sumAdd valueCopyTo sum

Page 19: High-level Languages

Hierarchy of abstractionHigh-level lang.program

Compiler

Assembly languageprogram

Assembler

Machine language program

Language closest to "how humans think."Input for compiler

Page 20: High-level Languages

Hierarchy of abstractionHigh-level lang.program

Compiler

Assembly languageprogram

Assembler

Machine language program

Translates programs from a specific HLLinto a particular architecture's assemblylanguage.

Page 21: High-level Languages

Hierarchy of abstractionHigh-level lang.program

Compiler

Assembly languageprogram

Assembler

Machine language program

"Human readable" form of a particulararchitecture's machine language. Input for assembler.

Page 22: High-level Languages

Hierarchy of abstractionHigh-level lang.program

Compiler

Assembly languageprogram

Assembler

Machine language program

Translates a particular architecture'sassembly language into that archi-tecture's machine language.

Page 23: High-level Languages

Hierarchy of abstractionHigh-level lang.program

Compiler

Assembly languageprogram

Assembler

Machine language program

Binary form executable versionof program.

Page 24: High-level Languages

Interpreted Languages

Interpreter – a program that can execute high-level language programs "directly," without first being translated to machine language.

Code in the interpreter emulates the circuitry that understands how to carry out each machine language instruction.

Some are "scripting" languages, used to stitch together existing executables to perform higher level tasks.

Page 25: High-level Languages

Examples

TCL/TK

Python

Windows Batch files/Windows Scripting Host

Perl

PHP – web scripting language

Page 26: High-level Languages

Compiled vs. interpreted

Compiled execution

Hardware follows instruction cycle for each machine language instruction in the executable

Interpreted execution

Interpreter translates HLL statement, then imitates hardware to execute it.

Page 27: High-level Languages

Interpreted pros and cons

Pros

Cons

Page 28: High-level Languages

"Hybrid" languages

Goal: High Level Language with platform-independent executable format, performance close to compiled languages.

How?

Page 29: High-level Languages

Examples

Java – originally intended for set-top TV/Video boxes, widely used on the web

C# - Supported by MS .Net platform, their answer to Java

Page 30: High-level Languages

How it works

Source program is compiled to an intermediate form – byte code

Byte code is the assembly language for an imaginary architecture

For each supported platform, write a "virtual machine" emulator that reads byte code and emulates its execution.

Page 31: High-level Languages

Java sourceprogram

Java compiler

JavaVirtualMachine

JavaVirtualMachine

JavaVirtualMachine

JavaVirtualMachine

WintelHardware

SunHardware

IBMHardware

MacHardware

Java byte code

Page 32: High-level Languages

Web server

HTMLJavaApplet

JavaApplet

JavaApplet HTML

HTML

JavaVirtualMachine

JavaApplet

JavaVirtualMachine

JavaApplet

JavaVirtualMachine

JavaApplet

webrequest web

request

webrequest

Page 33: High-level Languages

"Just In Time" compilation

JVMs actually compile each bytecode instruction to native code the first time it is used.

Subsequent executions of that instruction are faster.

Why would the same instruction be used again?

Page 34: High-level Languages

Computer Systems

A computer system is the combination of hardware and operating system

An operating system is the software that controls the overall operation of the computer, managing the processor, memory, files and attached devices

Page 35: High-level Languages

Computer System examples

PC – MS Windows OS running on Intel CPU

Mac – Mac OS running on IBM or Intel CPU

Linux – Linux OS running on Intel CPU

Unix – Unix OS running on various hardware platforms

IBM – OS/400 running on IBM servers