* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Classification of Program Languages
Falcon (programming language) wikipedia , lookup
Indentation style wikipedia , lookup
Comment (computer programming) wikipedia , lookup
Functional programming wikipedia , lookup
Reactive programming wikipedia , lookup
Go (programming language) wikipedia , lookup
Program optimization wikipedia , lookup
Object-relational impedance mismatch wikipedia , lookup
Control flow wikipedia , lookup
Abstraction (computer science) wikipedia , lookup
History of compiler construction wikipedia , lookup
Programming language wikipedia , lookup
C Sharp (programming language) wikipedia , lookup
One-pass compiler wikipedia , lookup
Object-oriented programming wikipedia , lookup
Assembly language wikipedia , lookup
Classification of programming languages Learning Objectives • Learn how programming can be performed in machine code, assembly language and high level languages • Learn that there are different methods of programming known as a paradigms • Learn how interpreters and compilers are used to turn programming code in to machine code (0s and 1s) • Learn what bytecode is. Classification of programming languages Programming Languages Machine Code Assembly Code Imperative High Level Languages Object orientated Declarative Functional Classification of programming languages Machine Code • Computers originated in the early 40s and initially to aid the war effort. • Initially to programming them you had to speak the languge of computers which is 0s and 1s. This was either done by a series of switches or with special punch cards that were fed into the computer. • These 0s or 1s or binary was the machine code of the computer. The only language it really understands • Separated into two parts – The Opcode and the Operand. OPCODE OPERAND What to do What to do it on. Classification of programming languages Machine Code • Computers would use an instruction set to determine what the 0s and 1s meant. • TASK Work through Machine Code worksheet Classification of programming languages Assembly Language • Programming in machine code was very time consuming and very difficult to debug • The need to make programs more user friendly led to the development of Assembly language • The 0s and 1s used in the opcode was replaced with mnemonics • Look at the example given in the LMC • Can you create a multiplication program in the LMC Classification of programming languages Assembly Language • The assembly code still needs to be converted to machine code so an assembler is used to translate it into object code (Machine code) • Advantages of Assembler over high level languages • Programs are executed quickly as a complier does not optimise the machine code that it produces as effectively as a programmer who codes in an assembly language that maps directly to machine code. • Program code is relatively compact for the same reason • Assembly language allows direct manipulation of the registers on the processor, giving high levels of control. • Used in embedded systems with low memory and processing power. • Real time applications that require quick reponse times to inputs might also use assembly • Device drivers will also use assembly for more control over access to hardware Classification of programming languages High Level Languages • • • Increasing complex demands on computers lead to the development of high level languages to help programmers. High level languages are problem orientated rather than machine orientated (low level languages) • What the program will have to do rather than the components of the computer it will be used with. • Allows programs written with HLL to be portable. Different languages are suitable for different types of problems, e.g. scientific, mathematic, visual. • Classified into three groups • Imperative • Object orientated • Declarative Classification of programming languages High Level Languages • Imperative • Procedral languages • Work by typing list of instructions • Uses subroutines and procedures • Object orientated • Works by creating objects where the intructions required to run the program are contained within the object. Objects are grouped together or derived from classes. • Declarative • Use a set of facts and rules to declare an outcome rather than a process. A form of logical programming – used in artificial intelligent systems. Classification of programming languages High Level Languages • Main characteristics of high level languages • • • • • Easier to program as more like a natural language Need to be translated like assembly language One command in a high level language may consist of a great number of machine code instructions. They are portable. Use a wide variety of programming structures to help maintain and code applications. Classification of programming languages High Level Languages • Translating high-level languages • Interpreter • Reads a line and actions it straight away. • Can inefficient when dealing with iterative statements • With an IF statement the condition is interpreted first and the rest is interpreted only if the condition is true. Classification of programming languages High Level Languages • Interpreter • Benefits • You do not need to compile the whole program in order to run sections of code. You can execute the code one statement at a time. • As the code is translated each time it is executed, program code can be run on processors with different instruction sets • Because of this, an interpreter is most likely to be used whilst a program is being developed. Classification of programming languages High Level Languages • Interpreter • Drawbacks • No matter how many times a section of code is revisited in a program it will need translating every time. This means that the overall time needed to execute a program can be very long. • The source code can only be translated and therefore executed on a computer that has the same interpreter installed. • The source code must be distributed to users, whereas with a compiled program, only the executable code is needed. Classification of programming languages High Level Languages • Compiler Converts the whole source code into object code before the program can be executed. Object code can then be executed everytime. Execution will be quick Benefits Once compiled – no longer need the source code. Very difficult to reverse engineer. Drawbacks Can take a while to set up for debugging. Object code can only run on a computer that has the same platform Classification of programming languages High Level Languages • Bytecode This is the process whereby code is compiled to be platform independent.