Presentation is loading. Please wait.

Presentation is loading. Please wait.

Component 1.6.

Similar presentations


Presentation on theme: "Component 1.6."— Presentation transcript:

1 Component 1.6

2 Starter: Entry Ticket Complete the Entry Ticket on high and low level programming languages. Extension: Define the following keywords: High Level Programming Language Assembly Language Machine Code Low Level Programming Language

3 Learning Intentions and Outcomes
To develop an understanding of the different types of programming language and their applications. Grade 4 Define high and low level programming languages Explain the difference between high and low level languages in terms of human understanding Grade 5-6 Explain using examples the difference between high and low level languages with reference to human understanding Grade 7 Apply an understanding of the difference between High and Low level languages to explain scenarios where each are more appropriate

4 Assessment Outcomes Describe the characteristics and purpose of high-level and low-level languages Identify and describe situations that require the use of a high-level or a low-level language

5 Starter Discussion The correct order is
High Level Programming Language Things like Python, Java, C – They are written using words which makes them easy to understand Low Level Programming Language These are what the hardware of the computer understands – There are two types: Assembly Language This is like code- but broken down. It doesn’t use words and has a lot less instructions than high level languages like Python Machine Code This is the Binary 1s and 0s that the central processing unit is able to understand

6 Starter Discussion Why do computers use binary? Computers use binary because the CPU is a series of electronic switches that can be either ON or OFF – Think about electricity, it is either on or off.

7 Starter Discussion What is the difference between a High and Low Level Programming Language? High level languages are programmed using words that are close to English. This makes it easier for a human to understand. Low Level Languages may contain words but they are usually not close to language – they are harder for a human to understand than high level languages.

8 Starter Discussion Which language is easiest for humans to understand? Why? High Level Languages are easier to understand because they use words and phrases that are closer to English.

9 How do the levels of languages work?
High level: Languages that are close to English, contain lots of command words, and are easy to understand – Must be converted into Machine Code before it can be used. Assembly: Uses Mnemonics (like words) to run code – is converted into Machine Code before it can be used. Machine code: Binary 1’s and 0’s that the central processor can understand!

10 High Level Languages A high level language is a programming language that allows code to be written. It is similar to a natural human language, such as English. Some programmers prefer to use high level programming languages, as they are easier to understand, learn and program. Their commands are similar to natural languages like English and identifiers can be long and meaningful. High level programming languages also allow the use of powerful commands that perform quite complex tasks such as MsgBox in Visual Basic or the SORT clause in COBOL. Examples of common high level programming languages include: Basic Java Pascal COBOL C# C++

11 Low Level Languages Assembly code uses mnemonics and is converted to machine code for execution using an assembler. Programming in a low level language, such as assembly code requires knowledge of the internal structure of the CPU and is therefore very specialised. The program statements are written for a particular type of CPU and make direct reference to specific internal registers. Source code produced in a low level language, is not portable, but it can be very efficient and the programs can be made to run faster than programs produced using a high level language.

12 Machine Code Machine code is the opposite of a high level language in that it does not resemble any natural language and is made up entirely of bit patterns (instructions or data) that can be executed directly by the CPU. High level languages must be converted into machine code before they can be executed by the CPU. Examples of machine code instructions are opcodes and operands. Opcodes are codes that tell the program what to do. For example: ADD – (Add) LDA – (Load) STA – (Store) Operands are the rest of the Machine Code instruction. For example: ADD, A7, 99 – This tells the machine to add 99 to the value in register A7

13 Difference between High and Low Level
OukpDfsuXE

14 Grade 4: High and Low Level Languages
Put the Title ‘High and Low Languages’ in your book and answer the Grade 4 Exercises. Extension Research what Assemblers, Compilers, and Interpreters do and the differences between them. Define High Level Code Define Low Level Code Explain the two types of Low Level Code Explain the difference between High and Low Level Code Give 2 reasons why a programmer might program in High Level Code instead of Low Level. Explain why High Level Code takes longer to run than Low Level Code

15 Getting the code to run:
Before High Level or Assembly Level code can be run it needs to be turned into Machine Code. To turn these into Machine Codes one of the following converters needs to be used: Assembler Interpreter Compiler Translator

16 Assemblers An assembler is a program which coverts the low level assembly programming language into machine code. The assembler does this by converting the one-word assembly instructions into an opcode, e.g. converting AND to It also allocates memory to variables, often resulting in an operand. Assembly code Assembler conversion Opcode Operand AND A 0010 0001 LOD B 0110

17 Compilers A compiler is used when high-level programming languages are converted into machine code, ready to be executed by the CPU. There are 4 stages of compilation: Lexical Analysis Syntax Analysis Semantic Analysis Code Generation Lexical analysis Comments and unneeded spaces are removed. Keywords, constants and identifiers are replaced by 'tokens'. A symbol table is created which holds the addresses of variables, labels and subroutines. Syntax analysis Tokens are checked to see if they match the spelling and grammar expected, using standard language definitions. This is done by parsing each token to determine if it uses the correct syntax for the programming language. If syntax errors are found, error messages are produced. Semantic analysis Variables are checked to ensure that they have been properly declared and used. Variables are checked to ensure that they are of the correct data type, e.g. real values are not being assigned to integers. Operations are checked to ensure that they are legal for the type of variable being used, e.g. you would not try to store the result of a division operation as an integer. Code generation Machine code is generated. Code optimisation may be employed to make it more efficient/faster/less resource intense.

18 Interpreters Before high level programming languages can be run, code is converted by an interpreter, one line at a time, into machine code, which is then executed by the CPU.

19 Translators A translator changes (translates) a program written in one language into an equivalent program written in a different language. For example, a program written using the PASCAL programming language may be translated into a program written in one of the C programming languages using a translator.

20 Interpreters and Compilers
Translates program one statement at a time. Scans the entire program and translates it as a whole into machine code. It takes less amount of time to analyze the source code but the overall execution time is slower. It takes large amount of time to analyze the source code but the overall execution time is comparatively faster. No intermediate object code is generated, hence are memory efficient. Generates intermediate object code which further requires linking, hence requires more memory. Continues translating the program until the first error is met, in which case it stops. Hence debugging is easy. It generates the error message only after scanning the whole program. Hence debugging is comparatively hard. Programming language like Python, Ruby use interpreters. Programming language like C, C++ use compilers.

21 Grade 4: Converting Code
Put the heading “Converting Code” in your book and answer the Grade 4 Questions. Extension Pick up the Grade 5-7 Exam Questions from the front of the room and complete them. Explain what the following programs do: Assembler Translator Interpreter Explain what a compiler does, including the 4 different stages Explain the difference between Compilers and Interpreters

22 Grade 5-7 Exam Questions Complete them Self Assess them Stick them in
Bring them to me

23 Grade 8 Extension This is the A-Level specification for Compilers and Interpreters. Use the following links to research each of the statements. ict.com/as_as_computing/ocr/H447/F4 53/3_3_2/translators_compilers/miniwe b/pg14.htm ict.com/as_as_computing/ocr/H447/F4 53/3_3_2/translators_compilers/miniwe b/index.htm Describe the purpose and give examples of the use of compilers, interpreters and assemblers, and distinguish between them. Describe the principal stages involved in the compilation process: lexical analysis, symbol table construction, syntax analysis, semantic analysis, code generation and optimization. Distinguish between and give examples of translation and execution errors

24 Exit Ticket Complete the Exit Ticket and Stick it in your books.

25 Homework Graded Exercises Complete up to your year 11 target grade
Pre-Reading Make notes on Pages 66-69: Software Development Lifecycle Waterfall Method Software Development Environment


Download ppt "Component 1.6."

Similar presentations


Ads by Google