Algorithms and Programming: Understanding Machine Languages and High-Level Languages - Pro, Study notes of Computer Science

An overview of algorithms and programming languages. It discusses the evolution of programming languages from machine languages to high-level languages, the differences between them, and the process of translating high-level languages into machine language for computer execution. The document also covers interpreters and compilers, their advantages and disadvantages, and their roles in program translation.

Typology: Study notes

Pre 2010

Uploaded on 07/31/2009

koofers-user-l9r
koofers-user-l9r ๐Ÿ‡บ๐Ÿ‡ธ

8 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
3/4/2009
1
Chapter 8 โ€“ con't
Algorithms and Programming
Languages
Algorithms and Programming
๎˜programming is all about designing and coding
algorithms for solving problems
๎˜the intended executor is the computer or a program
executing on that computer
๎˜instructions are written in programming languages
which are more constrained and exact than human
languages
Algorithms and Programming
๎˜the level of precision necessary to write
programs can be frustrating to beginners
๎˜but it is much easier than it was 50 years ago
๎˜early computers (ENIAC) needed to be wired to
perform computations
๎˜with the advent of the von Neumann architecture,
computers could be programmed instead of rewired
๎˜an algorithm could be coded as instructions, loaded
into the memory of the computer, and executed
Machine Languages
๎˜the first programming languages were known as
machine languages
๎˜
a machine language
consists of instructions that
correspond directly to the hardware operations of a
particular machine
๎˜i.e., instructions deal directly with the computerโ€™s physical
components including main memory, registers, and memory
cells in the CPU
๎˜very low level of abstraction
๎˜machine language instructions are written i n binary
๎˜programming in machine language is tedious and
error prone
๎˜code is nearly impossible to understand and
debug
Machine Languages
๎˜excerpt from a machine language program:
High-Level Languages
๎˜in the early 1950โ€™s,
assembly languages
evolved from
machine languages
๎˜an assembly language substitutes words for binary codes
๎˜much easier to remember and use words, but still a low
level of abstraction (instructions correspond to hardware
operations)
๎˜in the late 1950's,
high-level languages
were introduced
๎˜high-level languages allow the programmer to write code
closer to the way humans think (as opposed to mimicking
hardware operations)
๎˜a much more natural way to solve problems
๎˜plus, programs are machine independent
pf3

Partial preview of the text

Download Algorithms and Programming: Understanding Machine Languages and High-Level Languages - Pro and more Study notes Computer Science in PDF only on Docsity!

Chapter 8 โ€“ con't

Algorithms and Programming

Languages

Algorithms and Programming

 programming is all about designing and coding

algorithms for solving problems

 the intended executor is the computer or a program executing on that computer  instructions are written in programming languages which are more constrained and exact than human languages

Algorithms and Programming

 the level of precision necessary to write

programs can be frustrating to beginners

 but it is much easier than it was 50 years ago  early computers (ENIAC) needed to be wired to perform computations  with the advent of the von Neumann architecture, computers could be programmed instead of rewired  an algorithm could be coded as instructions, loaded into the memory of the computer, and executed

Machine Languages

 the first programming languages were known as

machine languages

 a machine language consists of instructions that correspond directly to the hardware operations of a particular machine  i.e., instructions deal directly with the computerโ€™s physical components including main memory, registers, and memory cells in the CPU  very low level of abstraction  machine language instructions are written in binary  programming in machine language is tedious and error prone  code is nearly impossible to understand and debug

Machine Languages

 excerpt from a machine language program:

High-Level Languages

 in the early 1950โ€™s, assembly languages evolved from

machine languages  an assembly language substitutes words for binary codes  much easier to remember and use words, but still a low level of abstraction (instructions correspond to hardware operations)

 in the late 1950's, high-level languages were introduced

 high-level languages allow the programmer to write code closer to the way humans think (as opposed to mimicking hardware operations)  a much more natural way to solve problems  plus, programs are machine independent

High-Level Languages

two high level languages that perform the same task (in JavaScript and C++)

Program Translation

 using a high-level language, the programmer is able to reason at a high-level of abstraction  but programs must still be translated into machine language that the computer hardware can understand/execute

 there are two standard approaches to program translation  interpretation  compilation

Program Translation

 real-world analogy: translating a speech from one language to another  an interpreter can be used provide a real-time translation  the interpreter hears a phrase, translates, and immediately speaks the translation  ADVANTAGE: the translation is immediate  DISADVANTAGE: if you want to hear the speech again, must interpret all over again  a translator (or compiler) translates the entire speech offline  the translator takes a copy of the speech, returns when the entire speech is translated  ADVANTAGE: once translated, it can be read over and over very quickly  DISADVANTAGE: must wait for the entire speech to be translated

Interpreters

 for program translation, the interpretation approach relies

on a program known as an interpreter to translate and

execute high-level statements  the interpreter reads one high-level statement at a time, immediately translating and executing the statement before processing the next one  JavaScript is an interpreted language

Interpreters Compilers

 the compilation approach relies on a program known as a

compiler to translate the entire high-level language

program into its equivalent machine-language instructions  the resulting machine-language program can be executed directly on the computer  most languages used for the development of commercial software employ the compilation technique (C, C++)