Programming Language Basics What is a Programming Language

Programming Language Basics

What is a Programming Language? ü “A computer, human-created language used to write instructions for a computer. ” ü “An artificial language that enables people to instruct machines. Computer commands that form procedures by which software programmers design and implement computer software programs. ” ü “A computer tool that allows a programmer to write commands in a format that is more easily understood or remembered by a person, and in such a way that they can be translated into codes that the computer can understand execute. ”

High Level vs. Low Level ü A high level programming language is one that is easy to learn and similar to English ü A low level programming language is more difficult to learn but more closely resembles what actually goes on inside a computer

Machine Code ü At the lowest level, we have machine code which consists of 0’s and 1’s ü Computers ultimately can only understand machine code ü Machine code can look something like what you saw in the movie The Matrix

001010100010010010100101001001010101010111010100101 01110100010100101111101001110101001 000100101011010101011000100 1010111110110010010001111010100101010001010100010 0100101001010100100101010 10010111010101110100010100 1011111010011101010010010101101 01011101011000100101011111011001001 00011110101001010010101001111101011001001111010010001 0100110100000010111010011111010 01001010100101000010010100

High Level Code ü On the other hand, high level language code is much easier for us to understand write ü Examples of high level programming languages? ü Java, Visual Basic, C/C++, Turing, Fortran, Pascal

What High Level Code Looks Like in Turing if grade >= 60 then put “You passed!” else put “You failed!” end if

What High Level Code Looks Like in Java if (grade >= 60) { System. out. println(“You passed”); } else { System. out. println(“You failed”); }

The Compiler ü A compiler is a program that translates high level program code into low level machine code ü A compiler usually checks your high level code for syntax errors before translating it

if (grade >= 60) printf (“You passed!”); else printf (“You failed!”); High level code 001010100100010010100 1010101010010010 machine code compile
- Slides: 10