Presentation is loading. Please wait.

Presentation is loading. Please wait.

Programming Language Rico Yu. Levels of Programming Languages 1.Low level languages 2.High level languages.

Similar presentations


Presentation on theme: "Programming Language Rico Yu. Levels of Programming Languages 1.Low level languages 2.High level languages."— Presentation transcript:

1 Programming Language Rico Yu

2 Levels of Programming Languages 1.Low level languages 2.High level languages

3 Low level languages  Machine language Machine language Directly executable by CPU  Assembly language Machine dependent Mnemonic codes ( 易記碼 )  each opcode Need to translate to machine code first – not directly executable

4 High level language  Machine independent and portable  Human like language  3GL C, Fortran, COBOL, BASIC, PASCAL, etc.  4GL SQL (Structured Query Language)

5 3GL LanguageFull nameApplication COBOL Common Business Oriented Language Commercial Prolog Programming in logic Artificial Intelligence ( 人工 智能 ) expert systems LISP List Processing BASIC Beginner's All- purpose Symbolic Instruction Code General purpose FORTRAN Formula TranslatorScientific

6 4GL  e.g. SQL command select * from student order by class, class_no; - display all the student records in the database table “student” in ascending order of class and class_no.

7 Advantages of high-level language over low-level language Advantages of HIGH level language Reasons 1. More effectiveDesigned to solve problem 2. Easier to learn, write, read and modify Instructions are English-like format 3. Programs are shorter in length One high-level language statement take the place of many machine instructions 4. Portable (can use in different computers with little modification) Machine-independent

8 Advantages of low-level language over high-level language Advantages of LOW level language Reasons 1. More efficientHardware features, like bus width, is fully made use of 2. Require smaller memory space to run Fewer low-level instructions are needed to do the same task (no redundant instructions produced by a translator) 3. Precise control of hardware Some low-level instructions are designed specifically for controlling the hardware at low level

9 Translators  Is a software  Converts the source code into machine instructions  Syntax errors of a program are detected in the translation phase  Three types of translators: assembler, compiler, interpreter

10 Assembler  Produces one machine instruction for each assembly language statement  Translates the whole source program before execution takes place

11 Compiler  Converts the whole source program before execution takes place  The computer needs the object program only

12 Interpreter  No object program is produced  The translated machine instructions CANNOT be reused  Interpreter must be present

13 Comparison of Translators AssemblerCompilerInterpreter Translate low- level language into machine language Translate high-level language into machine language A new file, called object program, is created No new file is produced Programs run fasterPrograms run slower

14 Comparison of Translators AssemblerCompilerInterpreter Translate the whole source programTranslate and execute a statement at a time Less convenient for programmer. Every change in the source program needs compilation Convenient for programmer Programmer can hide the source program The source program must be present Translator is not necessary at run-timeTranslator is necessary at run-time

15 Machine instruction Op. codeOperand Op. code is the operation to be performed. Operand is the data to be acted on.


Download ppt "Programming Language Rico Yu. Levels of Programming Languages 1.Low level languages 2.High level languages."

Similar presentations


Ads by Google