Edexcel GCSE Computer Science Topic 19 Programming Languages

  • Slides: 4
Download presentation
Edexcel GCSE Computer Science Topic 19 - Programming Languages

Edexcel GCSE Computer Science Topic 19 - Programming Languages

Programming Language Spectrum “A programming language is a formal constructed language designed to communicate

Programming Language Spectrum “A programming language is a formal constructed language designed to communicate instructions to a machine” High Level Low Level Assembly Languages Machine Code Java C++ Natural Languages Pseudocode Python English, German etc • Machine code is the lowest level language, made up of just 0 s and 1 s. It is written for specific processors (so it is not very portable, but executes very fast). Programming in machine code is impractical, not only because is code extremely long, but errors are incredibly difficult to find. • Assembly languages are also classed as a low level language, though they are slightly more programmer-friendly (using simple mnemonics like ‘ADD’) and are designed for programming hardware directly and with high control. • High level programming languages are even more like ordinary languages meaning they are far easier to use, although they still have strict syntax. They are portable, meaning they can be written on one computer and executed on many others. They are designed more with usability and simplicity in mind than efficiency. • Source code is the written, original form of code (that hasn’t been translated yet).

Translators …a translator is a program that converts code from one language into another.

Translators …a translator is a program that converts code from one language into another. • To execute code, it needs to be translated to machine code. Two types of high-level translators are: COMPILER High level → Machine High level • A compiler scans through the whole code, and translates it all into object code (a version of machine code perhaps with some translator instructions not in the original source code). Before = source, After = object • After a program has been compiled it can be directly executed by the processor (you can create a. exe file) • Once it has been translated the compiler and source code are no longer needed, and the execution is fast because the object code can be executed immediately. However, when changes are made to the source code, it needs to be fully compiled again, so any rapid changes (perhaps when debugging) will take a long time. INTERPRETER High level → Machine High level • An interpreter translates a line of code, then immediately executes it (so it works line-by-line). • It may translate to an intermediate form, then execute that, or/ and make use of stored pre-compiled subprograms • Program code needs to be translated every time using an interpreter, making it slower than a compiler. • It is more flexible than a compiler, and during testing especially, it allows you to execute small sections of code only.