Presentation is loading. Please wait.

Presentation is loading. Please wait.

LING 408/508: Programming for Linguists Lecture 1 August 24 th.

Similar presentations


Presentation on theme: "LING 408/508: Programming for Linguists Lecture 1 August 24 th."— Presentation transcript:

1 LING 408/508: Programming for Linguists Lecture 1 August 24 th

2 Administrivia 1.Syllabus 2.Introduction 3.Quickie Homework 1 – due Wednesday night by midnight in my e-mailbox I will assume everyone has a laptop…

3 Syllabus Details – Instructor: Sandiway Fong Depts. Linguistics and Computer Science – Email: sandiway@email.arizona.edu (homeworks go here)sandiway@email.arizona.edu – Office: Douglass 311 – Hours: by appt. or walk-in, after class – Meet: Shantz 338, Mondays/Wednesdays 3:15-4:30pm – No class on: Monday September 7th (Labor Day) Wednesday November 11 th (Veterans Day) Week after September 11 th (out of town), plus Monday 21 st Monday October 12 th – My academic webpage: dingo.sbs.arizona.edu/~sandiway/ or just Google me

4 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)

5 Syllabus Pre-requisites: – none! 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 examples: Bash shell, Python, Javascript, Perl, Tcl/Tk, HTML/CSS, MySQL, cgi-bin etc.

6 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

7 Syllabus Grading – 408: homeworks (80%), term programming project (20%) – 508: homeworks (65%), term programming project (35%) – Note: requirement – you must 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 Monday (resp. Wednesday), due Sunday (resp. Tuesday) night by 11:59pm in my mailbox – all homeworks will be reviewed in class

8 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.”

9 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)

10 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 …

11 Introduction Memory – CPU registers – L1/L2 cache – RAM – SSD/hard drive – blu ray/dvd/cd drive fast slow invisible to programmers open file read/write

12 Introduction 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) addressable Memory (RAM) 0 FFFFFFFF your Intel and ARM CPUs array a[23]

13 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

14 Introduction anandtech.com A 4 core machine: 8 virtual

15 Introduction Machine Language – A CPU understands only one language: machine language all other languages 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

16 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

17 Introduction Storage: – based on digital logic – binary (base 2) – everything is a power of 2 – Byte: 8 bits 01011011 = 2 6 +2 4 +2 3 +2 1 +2 0 = 64 + 16 + 8 + 2 + 1 = 91 (in decimal) – Hexadecimal (base 16) 0-9,A,B,C,D,E,F (need 4 bits) 5B (= 1 byte) = 5*16 1 + 11 = 80 + 11 = 91 2727 2626 2525 2424 23232 2121 2020 2727 2626 2525 2424 23232 2121 2020 01011011 23232 2121 2020 23232 2121 2020 5 B 23232 2121 2020 23232 2121 2020 0101 23232 2121 2020 23232 2121 2020 01011011 16 1 16 0 16 1 16 0 5B

18 Introduction: data types Integers – In one byte (= 8 bits), what’s the largest and smallest number, we can represent? – 00000000 = 0 – 01111111 = 127 – 10000000 = -128 – 11111111 = -1 0…127-128-127 0000000011111111 2’s complement representation

19 Introduction: data types Integers – In one byte, what’s the largest and smallest number, we can represent? – Answer: -128.. 0.. 127 using the 2’s complement representation – Why? super-convenient for arithmetic operations – “to convert a positive integer X to its negative counterpart, flip all the bits, and add 1” – Example: – 00001010 = 2 3 + 2 1 = 10 (decimal) – 11110101 + 1 = 11110110 = -10 (decimal) – 11110110 flip + 1 = 00001001 + 1 = 00001010 Addition: -10 + 10 = 11110110 + 00001010 = 0 (ignore overflow)

20 Introduction: data types Typically 32 bits (4 bytes) are used to store an integer – range: -2,147,483,648 (2 (31-1) -1) to 2,147,483,647 (2 (32-1) -1) what if you want to store even larger numbers? – Binary Coded Decimal (BCD) – code each decimal digit separately, use a string (sequence) of decimal digits … 2 31 2 30 2 29 2 28 2 27 2 26 2 25 2 24 ……2727 2626 2525 2424 23232 2121 2020 byte 3byte 2byte 1byte 0 C: int

21 Introduction: data types what if you want to store even larger numbers? – Binary Coded Decimal (BCD) – 1 byte can code two digits (0-9 requires 4 bits) – 1 nibble (4 bits) codes the sign (+/-), e.g. hex C/D 23232 2121 2020 0000 23232 2121 2020 0001 23232 2121 2020 1001 0 1 9 2014 2 bytes (= 4 nibbles) +2014 2.5 bytes (= 5 nibbles) 23232 2121 2020 1100 C 23232 2121 2020 1101 D credit (+) debit (-)


Download ppt "LING 408/508: Programming for Linguists Lecture 1 August 24 th."

Similar presentations


Ads by Google