Lessons5-7 - CSE115 Course Notes Lesson 5: High-level...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE115 Course Notes ©2009 C. Alphonce and A. Decker Page 11 Lesson 5: High-level computer languages Writing large pieces of software, like a word processor, a computer game, a web browser, an MP3 player, or a payroll system, cannot be done effectively by writing all of its instructions at the low level provided by a machine language or assembly language. Instead, software is written in so-called high-level programming languages. High-level programming languages allow complex sequences of processor instructions to be expressed succinctly. For example, a fairly common thing to do in a computer program is to add two values (each stored in its own memory location) together and save the result into another memory location. In an assembly language program this might be expressed as: MOVB (R0) R2 MOVB (R1) R3 ADD R2 R3 MOVB R2 (R4) In contrast a high level language might express this as: Z := X + Y If nothing else the high level form is shorter than the assembly language form. While we think of programs written in high-level programming languages as executable, technically they are not. Just as a computer does not directly understand instructions expressed in assembly language, a computer does not directly understand instructions expressed in a high level language. Programs expressed in high-level languages must be expressed in a low-level machine language before being executable directly by a computer. The translation from high level form to low level form is more complex than the translation from assembly language to machine language: there is no longer a one-to-one correspondence between machine language instructions and high level instructions. It is still possible to automate this translation process. A compiler is a computer program that takes as its input a program expressed in a high level programming language and produces as its output a program in a low level form 3 . This demonstrates another significant result in computer science, namely the equivalence of programs and data (the inputs to programs). In the case of a compiler, its data (the input to the compiler) is itself a computer program. In fact, the output of the compiler is another computer program! Alan Turing noted that it is possible to write what is called a Universal Turing Machine. A Turing Machine (TM) is a very simple computer. By the Church-Turing thesis any program that can be expressed in any programming language can be carried out by a Turing Machine. Despite its simplicity, it is possible to write a TM which can take as its input another TM, and the input to that second TM, and have it simulate that TM on its input. Such a TM is called a Universal TM. 3 The low level form can be machine language, but often a compiler produces a program in assembly language, and relies on an assembler to complete the final translation.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
CSE115 Course Notes ©2009 C. Alphonce and A. Decker Page 12 A piece of software written in a high level language can be made to work on many different computers easily by compiling it from its high level form to the appropriate low level form
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/13/2011 for the course CSE 115 taught by Professor Decker during the Fall '08 term at SUNY Buffalo.

Page1 / 9

Lessons5-7 - CSE115 Course Notes Lesson 5: High-level...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online