1 / 11

Computer Languages

Computer Languages. There are many programming languages. This is because some are better suited for writing particular types of software applications than others. For example, there are programming languages that are particularly suitable for: commercial / financial applications

mercia
Download Presentation

Computer Languages

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 Languages

  2. There are many programming languages. This is because some are better suited for writing particular types of software applications than others. For example, there are programming languages that are particularly suitable for: • commercial / financial applications • scientific problems • creating computer games • controlling machines such as robots • safety critical programs e.g. controlling nuclear reactors Each language is designed to provide the programmer with the right kind of tools to do the job. Some computer languages Names: • BASIC • FORTRAN • C / C++ • LOGO • JAVA

  3. Low Level Language • At the most basic level. computers only understand one 'language' namely a series of binary 1s and 0s which is also known as machine code. • A computer program in binary looks like: 0010110101010101010101001010100001111111010101011 • This looks like gibberish to a person, but the computer could be playing some music or running a computer game - its all the same to the machine. • Machine Code is a 'Low Level Language'. A low level language creates instructions that directly control the CPU of a computer.

  4. Advantages / Dis-Advantages Advantages of Machine Code • Runs very fast compared to the code created by other types of programming language • Controls the computer directly • Each instruction only does one thing Disadvantages of Machine Code • It is specific to the CPU: each computer chip type has its own machine code • Very difficult for a person to read machine code and understand the purpose of what it is doing • Very slow to program in machine code

  5. Assembly Language • As you have seen, Machine code is quite difficult to work with as a programmer. • So to make things a bit easier, a language called Assembly Language was developed. This uses English-like commands that are easier to use. • For example the instruction to Add is • ADD A,B • The instruction to Subtract is • SUB A,B • and the instruction to move data from one part of the CPU to another is • MOV AL, EX

  6. Assembly Language • It is still a 'Low Level Language' because most of the instructions translate into only one Machine Code instruction. • Before instructions written in Assembly Language can be used, they must be translated into machine code by a programme called an Assembler. Advantage over Machine Code • Easier to remember the commands • Easier to fix (debug) when the wrong instructions are written • The same computer programme written in Assembly Language can be used over a range of computers as an Assembler for each type of computer chip is available.

  7. High level language Assembly language is only one step up from Machine Code It is still hard to understand what the program is meant to be doing overall. Plenty of comments within the program help but things could be easier. This is where 'High Level Languages' come in. A high level language is designed to have all the handy things that a programmer needs to write code quickly and correctly. It has commands such as PRINT, GOTO, IF A high level language is far easier to write than Assembly Language. It is also easier to fix because it is more obvious when a mistake has been made.

  8. Advantages of high level languages • Easier to understand • Easier to fix (debug) mistakes • Short commands such as "Print" for print data. • Independent of the computer it needs to run on • A high level language has to be translated into Machine Code. This is the job of a program called the 'Compiler'.

  9. Examples

  10. Translation programs • Eventually every computer programming language has to be converted into Machine Code so that the computer can carry out instructions. • There are two ways of carrying out this translation. 1) One line at a time. • With this kind of computer program, the high level program is loaded and then each instruction is converted into Machine Code and then run one line at a time. This type of language is called an Interpreted Language. • It is the job of a program called the Interpreter to carry out this translation. BASIC is an interpreted language. Advantage over a compiled language: • You can write one line of code and it can be immediately translated and run Disadvantage over a compiled language • Slow to run, as every single line has to be translated as you work

  11. 2) Translate all the instructions in one go • The idea behind this is to take the high level language computer program and translate it into machine code in one go. All the translated machine code is stored in a file called the 'object code' file. • It is the job of the 'Compiler' to convert a high level language into Machine Code Advantage: • It runs much faster than an interpreter because all the translation has been done before hand. Disadvantage • Any changes to the program means that the whole thing has to be compiled once again

More Related