1 / 35

High-level Languages

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

Download Presentation

High-level Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. High-level Languages

  2. Assembly language benefits • Hides details of hardware

  3. Assembly language benefits • Hides details of hardware • Easier to remember instruction names

  4. Assembly language benefits • Hides details of hardware • Easier to remember instruction names • A tiny step closer to how humans think

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

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

  7. Assembly Language issues • Still tied directly to the machine language instruction set

  8. Assembly Language issues • Still tied directly to the machine language instruction set • Most machine language instructions do only a tiny amount of work

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

  10. Example For each value I read in from a file If the value is negative, then add it to the list of expenditures Otherwise add it to the list of income (This is pseudo-code, like the way we write textual storyboards)

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

  12. Examples • COBOL – business application language • FORTRAN – scientific application language • BASIC, Pascal – teaching languages • Ada – designed and used for US military software • Smalltalk – early object-oriented language • C, C++ - systems/general purpose languages

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

  14. 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?

  15. Compiled languages • High level languages that are translated into a machine language executable are called "compiled languages." • Executables might be called "native code."

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

  17. 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 Java statement sum = sum + value;

  18. 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 Woody equivalent CopyFrom sum Add value CopyTo sum Java statement sum = sum + value;

  19. Hierarchy of abstraction Language closest to "how humans think." Input for compiler High-level lang. program Compiler Assembly language program Assembler Machine language program

  20. Hierarchy of abstraction High-level lang. program Translates programs from a specific HLL into a particular architecture's assembly language. Compiler Assembly language program Assembler Machine language program

  21. Hierarchy of abstraction High-level lang. program Compiler "Human readable" form of a particular architecture's machine language. Input for assembler. Assembly language program Assembler Machine language program

  22. Hierarchy of abstraction High-level lang. program Compiler Assembly language program Translates a particular architecture's assembly language into that archi- tecture's machine language. Assembler Machine language program

  23. Hierarchy of abstraction High-level lang. program Compiler Assembly language program Assembler Machine language program Binary form executable version of program.

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

  25. Examples • TCL/TK • Python • Windows Batch files/Windows Scripting Host • Perl • PHP – web scripting language

  26. 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. Compiled vs. interpreted

  27. Interpreted pros and cons • Pros • Cons

  28. "Hybrid" languages • Goal: High Level Language with platform-independent executable format, performance close to compiled languages. • How?

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

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

  31. Java Virtual Machine Java Virtual Machine Java Virtual Machine Java Virtual Machine Java source program Java compiler Java byte code Wintel Hardware Mac Hardware Sun Hardware IBM Hardware

  32. Java Virtual Machine Java Virtual Machine Java Virtual Machine HTML HTML HTML Java Applet Java Applet Java Applet Java Applet Java Applet Java Applet web request web request web request Web server

  33. "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?

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

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

More Related