180 likes | 292 Views
LING 408/508: Programming for Linguists. Lecture 1 August 26 th. Administrivia. Syllabus Introduction Quickie Homework 1 due Wednesday night by midnight in my e-mailbox I will assume everyone has a laptop…. Syllabus. Details Instructor: Sandiway Fong
E N D
LING 408/508: Programming for Linguists Lecture 1 August 26th
Administrivia • Syllabus • Introduction • Quickie Homework 1 • due Wednesday night by midnight in my e-mailbox • I will assume everyone has a laptop…
Syllabus • Details • Instructor: Sandiway Fong Depts. Linguistics and Computer Science • Email: sandiway@email.arizona.edu (homeworks) • Office: Douglass 311 • Hours: by appt. or walk-in, or after class (best) • Meet: AME S314, Tuesdays/Thursdays 5:00-6:15pm • No class on: • November 11th (Veterans Day) • November 27th (Thanksgiving) • My academic webpage: dingo.sbs.arizona.edu/~sandiway/ or Google me
Syllabus • dingo.sbs.arizona.edu/~sandiway/ • Lecture slides will be available online (.pptx and pdf formats) just before class (look for updates/corrections afterwards) • Lectures will be recorded using the panopto system (video, laptop screen, synchronized slides, keyword search)
Syllabus • Course Objectives: • Introduction to programming • data types, different programming styles, thinking algorithmically … • and fundamental computer concepts • computer organization: underlying hardware, and operating systems (processes, shell, filesystem etc.) • Operating System: • Ubuntu (Linux) • Programming Languages: • selected from: Bash shell, Python, Javascript, Perl, Tcl/Tk, HTML/CSS, MySQL, cgi-bin etc.
Syllabus • Expected learning outcomes: • familiarity with the underlying technology, terminology and programming concepts • acquire the ability to think algorithmically • acquire the ability to write short programs • build a graphical user interface • build a web application (with a relational database) • be equipped to take classes in the Human Language Technology (HLT) program and related classes
Syllabus • Grading • 408: homeworks (80%), term project (20%) • 508: homeworks (65%), bigger term project (35%) • Note: requirement -- submit all homeworks • Homework submissions: • email only to me • See homework 1 for the required format … • homeworks will be introduced in class • due date: • almost one week (typically) • example: homework presented in class on Tuesday, due following Monday night by midnight in my mailbox • all homeworks will be reviewed in class • one week later (typically)
Syllabus • Homeworks • you may discuss questions with other students • however, you must program/write it up yourself (in your own words/code) • cite (web) references and your classmates (in the case of discussion) • Student Code of Academic Integrity: plagiarism etc. • http://deanofstudents.arizona.edu/codeofacademicintegrity • Revisions to the syllabus • “the information contained in the course syllabus, other than the grade and absence policies, may be subject to change with reasonable advance notice, as deemed appropriate by the instructor.”
Syllabus • Absences • tell me ahead of time so we can make special arrangements, e.g. homeworks • I expect you to attend lectures (though attendance will not be taken)
Introduction • Computers • Memory • Programs and data • CPU • Interprets machine instructions • I/O • keyboard, mouse, touchpad, screen, touch sensitive screen, printer, usb port, etc. • bluetooth, ethernet, wifi, cellular …
Introduction • Memory • CPU registers • L1/L2 cache • RAM • SSD/hard drive • blu ray/dvd/cd drive fast invisible to programmers slow open file read/write
Introduction array a[23] • Memory Representation • binary: zeros and ones (1 bit) • organized into bytes (8 bits) • memory is byte-addressable • word (32 bits) • e.g. integer • (64 bits: floating point number) • big-endian/little-endian • most significant byte first or least significant byte • communication … addressable Memory (RAM) 0 your Intel and ARM CPUs FFFFFFFF
Introduction • A typical notebook computer • Example: a 2013 Macbook Air • CPU: Core i5-4250U • 1.3 billion transistors • built-in GPU • TDP: 15W (1.3 GHz) • Dual core (Turbo: 2.6 GHz) • Hyper-Threaded (4 logical CPUs, 2 physical) • 64 bit • 64 KB (32 KB Instruction + 32 KB Data) L1 cache • 256 KB L2 cache per core • 12MB L3 cache shared • 16GB max RAM Increased address space and 64-bit registers
Introduction anandtech.com A 4 core machine: 8 virtual
Introduction • Machine Language • A CPU understands only one language: machine language • allotherlanguages must be translated into machine language • Primitive instructions include: • MOV • PUSH • POP • ADD / SUB • INC / DEC • IMUL / IDIV • AND / OR / XOR / NOT • NEG • SHL / SHR • JMP • CMP • JE / JNE / JZ / JG / JGE / JL / JLE • CALL / RET Assembly Language:(this notation) by definition, nothing built on it is more powerful http://www.cs.virginia.edu/~evans/cs216/guides/x86.html
Introduction • Not all the machine instructions are conceptually necessary • many provided for speed/efficiency • Theoretical Computer Science • All mechanical computation can be carried out using a TURING MACHINE • Finite state table + (infinite) tape • Tape instructions: • at the tape head: Erase, Write, Move (Left/Right/NoMove) • Finite state table: • Current state x Tape symbol --> new state x New Tape symbol x Move
Introduction • Storage: • based on digital logic • binary (base 2) – everything is a power of 2 • Byte: 8 bits • 01011011 • = 26+24+23+21+20 • = 64 + 16 + 8 + 2 + 1 • = 91 • Hexadecimal (base 16) • 0-9,A,B,C,D,E,F (need 4 bits) • 5B (= 1 byte) • = 5*24 + 11 • = 80 + 11 • = 91
Introduction: data types • Integers • In one byte, what’s the largest and smallest number, we can represent? • Answer: -128 .. 0 .. 127 • Why? -28-1.. 0 .. 28-1 – 1 • 00000000 = 0 • 01111111 = 127 • 10000000 = -128 • 11111111 = -1 2’s complement representation super-convenient for arithmetic operations “to convert a positive integer X to its negative counterpart, flip all the bits, and add 1” Example: 00001010 = 23 + 21 = 10 11110101 + 1 = 11110110 = -10 11110110 flip + 1 = 00001001 + 1 = 00001010 11111110 = -2 11111101 = -3 11111100 = -4 11111011 = -5 11111010 = -6 11111001 = -7 11111000 = -8 11110111 = -9 11111010 = -10 Addition: -10 + 10 = 11110110 + 00001010 = 0 (ignore overflow)