1 / 10

Computer Systems

Computer Systems. Nat 4/5 Computing Science Translator Programs. Lesson Aims. By the end of this lesson: All pupils will be able to: Describe and compare the following types of languages: Machine Code High Level Languages Describe why High Level Languages require translation.

Download Presentation

Computer Systems

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. Computer Systems Nat 4/5 Computing Science Translator Programs

  2. Lesson Aims • By the end of this lesson: • All pupils will be able to: • Describe and compare the following types of languages: • Machine Code • High Level Languages • Describe why High Level Languages require translation. • Describe how interpreters and compilers function.

  3. Nat 4/5 Types Of Languages • Machine Code is made up of only 2 symbols. • 1 and 0 (On and Off) • High Level Languages such as Visual Basic are written using some English words. • They are not written IN english!

  4. Nat 4/5 High Level Languages

  5. Nat 4/5 Why do we need them? • The source code you write is instructions for the computer • They are in a High Level Language • The computer needs these instructions translated into machine code • It’s the only language it understands!

  6. Nat 4/5 Types of Translators • These programs convert High Level Language Source code into machine code (binary) • Interpreter • Translates and executes one line at a time • Compiler • Translates and executes the entire program at once • This program can then be ran repeatedly Think complete!

  7. Nat 4/5 Interpreter • Functions like a spoken language interpreter. • Translates and executes a single line at a time • The interpreter is ALWAYS loaded in memory • Error feedback is provided line by line • Like in Smallbasic • Interpreted programs have to be re-interpreted every single execution

  8. Nat 4/5 How an interpreter works Original Source Code Pctoutput.isible = true Interpreter Pctoutput.print “Hello” 1001 1000 1100 1110 0011 1001 1000 1100 1110 0011 Syntax Error

  9. 1001 1000 1100 1110 0011 1010 1010 1010 0111 0011 Nat 4/5 How the compiler works Can be saved and ran later Original Source Code Pctoutput.isible = true Pctoutput.print “Hello” Object Code Compiler Syntax Error

  10. Nat 4/5 Summary • Compilers translate source code once into an executable program • Only has to be translated once! • Cannot see the source code in a compiled program • Interpreters translate source code line by line • Always has to be re-interpreted • Spots errors line by line

More Related