* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download 99_Introduction
Reactive programming wikipedia , lookup
Library (computing) wikipedia , lookup
Programming language wikipedia , lookup
Abstraction (computer science) wikipedia , lookup
Object-oriented programming wikipedia , lookup
Structured programming wikipedia , lookup
Go (programming language) wikipedia , lookup
Program optimization wikipedia , lookup
Assembly language wikipedia , lookup
History of compiler construction wikipedia , lookup
Chapter 1 Computers, Compilers, & Unix Overview Computer hardware Unix Computer Compilers Languages Computer Hardware Central Processing Unit (CPU) The heart and brains of a computer The device that performs all calculations and data manipulation in a computer Main The Memory (RAM) place the CPU looks for instructions and data to process Computer Hardware Mass Storage (hard drive) Holds information not immediately needed by CPU Holds massive amounts of data Input/Output keyboard, Devices mouse, monitor, printer Devices used to move information into and out of the computer Basic Architecture Processor (CPU) Main Memory CPU Memory volatile I/O devices secondary memory communications terminals System a System Bus Disk Network Controller Controller Serial Device Controller interconnection bus is used to exchange data and control information What is an operating system? Acts as interface between computer system resources (hardware) and applications Manages the way other programs use system resources and communicate with each other Common operating systems Windows In XP, Macintosh OS, & Linux CS 201 we use Solaris, a type of Unix Unix file system Home directory A directory set aside for your personal use The starting point when you log in Working directory Whatever directory you are currently in The Initially, the working directory is the home directory cd command is used to change the working directory cd .. Moves up one level in the directory structure cd <directory> moves down one level, into the given directory The pwd command gives the full path of the working directory The ls command lists the contents of the working directory Programming Languages Common programming languages include … C C++ Java Pascal Visual Basic COBOL Lisp Scheme Ada These FORTRAN high-level languages Resemble human languages Are designed to be easy to read and write Use more complicated instructions than the CPU can follow Must be translated to zeros and ones for the CPU to execute a program Low-level Languages An assembly language command such as ADD X Y Z might mean add the values found at x and y in memory, and store the result in location z. Assembly language must be translated to machine language (zeros and ones) 0110 1001 1010 1011 The CPU can execute machine language instructions Compilers Translate high-level language to machine language Source the original program in a high level language Object code code the translated version in machine language Linkers Some programs we use are already compiled Their object code is available for us to use Input and output routines A Linker The combines object code for the programs we write and The object code for the pre-compiled routines into The machine language program the CPU can run From Source Code to Executable Program #include <iostream> using namespace std; int main() { cout << "Hello World!" << endl; return 0; } compiler 1001010100010 1010010101001 0010101001010 0101001001001 0100101010101 0010010100100 1001010010100 1010000100100 1001 library linker 0100101010010 1001010010010 0101001010101 0100100101001 0010010100101 0010100101010 1010100100100 1000100100100 1001 executable file 1001010100010 1010010101001 0010101001010 0101001001001 0100101010101 0010010100100 1001010010100 1010000100100 1001 object file Programming & Problem Solving Algorithm A sequence of precise instructions which leads to a solution Program An algorithm expressed in a language the computer can understand Program Design Programming No is a creative process complete set of rules for creating a program Design process for CS-201 Problem Solving Phase Produce an algorithm that solves the problem Implementation Translate & Testing Phase into a valid, functioning program Problem Solving Phase Be certain the task is completely specified What is the input? What information is in the output? How is the output organized? Develop the algorithm before implementation Experience shows this saves time in getting your program to run Test the algorithm for correctness Implementation & Testing Phase Translate Easier as you gain experience with the language Compile the source code The compiler identifies violations of the programming language's grammar Run the algorithm into a programming language These are known as syntax errors the program on sample data Verify correctness of results If you made mistakes in your algorithm design, or in your translation to the programming language, you'll see errors These are known as logic errors Modify the algorithm and/or program and repeat