computer languages computershumans 00101010110010 011000101110101 010111001001 10 0011 how can...

7
Computer Languages Computers Humans 00101010110010 011000101110101 010111001001 10 0011 How can humans “talk to” (instruct) computers? Answer: Computer languages (e.g., Java, C Python, FORTRAN, Basic, C++, Lisp, Ruby,

Upload: moses-atkins

Post on 30-Dec-2015

225 views

Category:

Documents


8 download

TRANSCRIPT

Page 1: Computer Languages ComputersHumans 00101010110010 011000101110101 010111001001 10 0011 How can humans “talk to” (instruct) computers? Answer: Computer

Computer Languages

ComputersHumans 00101010110010011000101110101 010111001001 10 0011

How can humans “talk to”(instruct) computers?

Answer: Computer languages (e.g., Java, C,Python, FORTRAN, Basic, C++, Lisp, Ruby, …)

Page 2: Computer Languages ComputersHumans 00101010110010 011000101110101 010111001001 10 0011 How can humans “talk to” (instruct) computers? Answer: Computer

Computer Languages

Alice Alice & BettyBetty

Consider: “Alice and Betty had on the same dress.”Natural languages are often ambiguous.

YES NO

Page 3: Computer Languages ComputersHumans 00101010110010 011000101110101 010111001001 10 0011 How can humans “talk to” (instruct) computers? Answer: Computer

Computer LanguagesConsider: “Alice and Betty ran from the same building.”

Alice Betty BettyAlice

YESNO

Page 4: Computer Languages ComputersHumans 00101010110010 011000101110101 010111001001 10 0011 How can humans “talk to” (instruct) computers? Answer: Computer

Computer Languages

It deosn't mttaer in waht oredr the ltteers in aword are, the iprmoatnt tihng is taht the fristand lsat ltteer are in the rghit pcale.

Natural languages contain a great deal of redundantinformation, making them quite “fault tolerant.”

Easy for a human to make sense of this despite13 of the 27 words being misspelled.

Page 5: Computer Languages ComputersHumans 00101010110010 011000101110101 010111001001 10 0011 How can humans “talk to” (instruct) computers? Answer: Computer

Computer Languages• Computers typically can’t tolerate ambiguity or

mistakes.• Statements (instructions) must be unambiguous

and without mistakes.• Computer languages provide framework for

humans to communicate to computers in a waythat is almost natural to humans.

Page 6: Computer Languages ComputersHumans 00101010110010 011000101110101 010111001001 10 0011 How can humans “talk to” (instruct) computers? Answer: Computer

Computer Languages

int main() { printf(”Hi\n”); return 0;}

Source FileCompiler Executable

File100101000111010111010011010000110010100

ExecutableFile

100101000111010111010011010000110010100

Processor

Output/Results

Two-step process toexecute source code.

Page 7: Computer Languages ComputersHumans 00101010110010 011000101110101 010111001001 10 0011 How can humans “talk to” (instruct) computers? Answer: Computer

Computer LanguagesSource File

Interpreter

Output/Results

Source code isexecuted directly.

• We will use Python interpreter.• Compilers better at catching errors and

producing faster code.• Interpreters better for developing code

and learning to use a language.

print(”Hi”)

Interactive Environment