Component 1.6.

Slides:



Advertisements
Similar presentations
GCSE Computing Lesson 5.
Advertisements

The Functions and Purposes of Translators Code Generation (Intermediate Code, Optimisation, Final Code), Linkers & Loaders.
Programming Types of Testing.
1 Pass Compiler 1. 1.Introduction 1.1 Types of compilers 2.Stages of 1 Pass Compiler 2.1 Lexical analysis 2.2. syntactical analyzer 2.3. Code generation.
CPSC Compiler Tutorial 9 Review of Compiler.
Chapter 16 Programming and Languages: Telling the Computer What to Do.
Introduction to a Programming Environment
1 CHAPTER 4 LANGUAGE/SOFTWARE Hardware Hardware is the machine itself and its various individual equipment. It includes all mechanical, electronic.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
Compiled by Benjamin Muganzi 3.2 Functions and Purposes of Translators Computing 9691 Paper 3 1.
Activity 1 - WBs 5 mins Go online and spend a moment trying to find out the difference between: HIGH LEVEL programming languages and LOW LEVEL programming.
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
Higher Grade Computing Studies 2. Languages and Environments Higher Computing Software Development S. McCrossan 1 Classification of Languages 1. Procedural.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
1 Programming Languages Tevfik Koşar Lecture - II January 19 th, 2006.
Unit-1 Introduction Prepared by: Prof. Harish I Rathod
Evolution and History of Programming Languages 1.
Introduction to Compilers. Related Area Programming languages Machine architecture Language theory Algorithms Data structures Operating systems Software.
What Do I Represent?. Translators – Module Knowledge Areas Revisiting object code When we disassemble code we can view the opcodes used This is just a.
1 Compiler Design (40-414)  Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007  Evaluation:  Midterm.
Intermediate 2 Computing Unit 2 - Software Development Topic 2 - Software Development Languages and Environments.
Chapter One An Introduction to Programming and Visual Basic.
1 3. Computing System Fundamentals 3.1 Language Translators.
1 Compiler & its Phases Krishan Kumar Asstt. Prof. (CSE) BPRCE, Gohana.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
Compilers and Interpreters
Representation of Data Binary Representation of Instructions teachwithict.weebly.com.
Representation of Data - Instructions Start of the lesson: Open this PowerPoint from the A451 page – Representation of Data/ Instructions How confident.
OCR A Level F453: The function and purpose of translators Translators a. describe the need for, and use of, translators to convert source code.
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
Programming Languages Salihu Ibrahim Dasuki (PhD) CSC102 INTRODUCTION TO COMPUTER SCIENCE.
Introduction to computer software. Programming the computer Program, is a sequence of instructions, written to perform a specified task on a computer.
Introduction to Software
Evolution and History of Programming Languages
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Why don’t programmers have to program in machine code?
Lecture 1b- Introduction
Advanced Computer Systems
Component 1.6.
Compiler Design (40-414) Main Text Book:
GCSE COMPUTER SCIENCE Computers 1.5 Assembly Language.
High or Low Level Programming Language? Justify your decision.
High and low level languages
Component 1.6.
CSCI-235 Micro-Computer Applications
F453 Computing Questions and Answers
课程名 编译原理 Compiling Techniques
A451 Theory – 7 Programming 7A, B - Algorithms.
History of compiler development
Entry Ticket: High and Low Level Languages
Compiler Construction
Teaching Computing to GCSE
TRANSLATORS AND IDEs Key Revision Points.
Teaching Computing to GCSE
Translators & Facilities of Languages
Course supervisor: Lubna Siddiqui
Compiler Construction
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Lesson Objectives Aims Key Words Compiler, interpreter, assembler
CMP 131 Introduction to Computer Programming
Chapter One: An Introduction to Programming and Visual Basic
Introduction to Computer Programming
PROGRAMMING FUNDAMENTALS Lecture # 03. Programming Language A Programming language used to write computer programs. Its mean of communication between.
ICT Programming Lesson 1:
Tonga Institute of Higher Education IT 141: Information Systems
Tonga Institute of Higher Education IT 141: Information Systems
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Software Development Environment, File Storage & Compiling
1.3.7 High- and low-level languages and their translators
WJEC GCSE Computer Science
Presentation transcript:

Component 1.6

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

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

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

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

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.

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.

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.

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!

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++

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.

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

Difference between High and Low Level https://www.youtube.com/watch?v=1 OukpDfsuXE

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

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

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 0010. It also allocates memory to variables, often resulting in an operand. Assembly code Assembler conversion Opcode Operand AND A → 0010 0001 LOD B 0110

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.

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.

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.

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.

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

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

Grade 8 Extension This is the A-Level specification for Compilers and Interpreters. Use the following links to research each of the statements. http://www.teach- ict.com/as_as_computing/ocr/H447/F4 53/3_3_2/translators_compilers/miniwe b/pg14.htm http://www.teach- 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

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

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