/
LING 408/508: Programming for Linguists LING 408/508: Programming for Linguists

LING 408/508: Programming for Linguists - PowerPoint Presentation

faustina-dinatale
faustina-dinatale . @faustina-dinatale
Follow
376 views
Uploaded On 2016-05-24

LING 408/508: Programming for Linguists - PPT Presentation

Lecture 1 August 24 th Administrivia Syllabus Introduction Quickie Homework 1 due Wednesday night by midnight in my emailbox I will assume everyone has a laptop Syllabus Details Instructor Sandiway Fong ID: 332447

syllabus introduction data bits introduction syllabus bits data machine programming homeworks byte decimal class types tape monday write instructions

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "LING 408/508: Programming for Linguists" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

LING 408/508: Programming for Linguists

Lecture 1

August 24

thSlide2

Administrivia

Syllabus

Introduction

Quickie Homework 1

due Wednesday night by midnight in my e-mailbox

I will assume everyone has a laptop… Slide3

Syllabus

Details

Instructor: Sandiway Fong

Depts. Linguistics and Computer Science

Email:

sandiway@email.arizona.edu

(

homeworks

go here

)

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 meSlide4

Syllabus

dingo.sbs.arizona.edu

/~

sandiway

/

Lecture

slides will be available online (.

pptx and pdf formats) just before class look for updates/corrections afterwardsLectures will be recorded using the panopto system (video, laptop screen, synchronized slides, keyword search)Slide5

Syllabus

Pre-requisites:

none!

Course Objectives:

Introduction to programming

data types, different programming styles, thinking algorithmically …

a

nd fundamental computer conceptscomputer 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.Slide6

Syllabus

Expected learning outcomes:

familiarity with the

underlying technology

, terminology and

programming concepts

acquire

the ability to think algorithmicallyacquire the ability to write short programsbuild a graphical user interfacebuild a web application (with a relational database)be equipped to take

classes in the Human Language Technology (HLT) program and related classesSlide7

Syllabus

Grading

408:

homeworks

(80%), term programming project (20%)

508:

homeworks

(65%), term programming project (35%)Note: requirement – you must submit all homeworksHomework submissions:email only to meSee homework 1 for the required format …

homeworks will be introduced in classdue date: almost

one week (typically)

e

xample

: homework presented in class on Monday (resp. Wednesday), due Sunday (resp. Tuesday) night by 11:59pm in my mailbox

a

ll

homeworks

will be reviewed in classSlide8

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/codeofacademicintegrityRevisions 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.”Slide9

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

)Slide10

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

Introduction

Memory

CPU registers

L1/L2 cache

RAM

SSD/hard drive

blu

ray/dvd/cd drive

fast

slow

i

nvisible to

programmers

o

pen file

r

ead/writeSlide12

Introduction

Memory Representation

b

inary: zeros and ones (1 bit)

organized into bytes (8 bits)

m

emory is byte-addressable

word (32 bits)e.g. integer(64 bits: floating point number)big-endian/little-endianmost significant byte first or least significant bytec

ommunication …

a

ddressable

Memory

(RAM)

0

FFFFFFFF

y

our Intel and ARM CPUs

array

a[23]Slide13

Introduction

A typical notebook computer

Example

: a 2013

Macbook

Air

CPU:

Core i5-4250U1.3 billion transistorsbuilt-in GPUTDP: 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 registersSlide14

Introduction

a

nandtech.com

A 4 core machine: 8 virtualSlide15

Introduction

Machine Language

A CPU understands only one language: machine language

a

ll

other

languages must be translated into machine languagePrimitive instructions include:MOVPUSHPOPADD / SUBINC / DEC

IMUL / IDIVAND / OR / XOR / NOTNEGSHL / SHRJMPCMP

JE / JNE / JZ / JG / JGE / JL / JLE

CALL / RET

Assembly Language:

(this notation)

b

y definition, nothing built on it is more powerful

http://

www.cs.virginia.edu

/~

evans

/cs216/guides/x86.htmlSlide16

Introduction

Not all the machine instructions are conceptually necessary

m

any 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 MoveSlide17

Introduction

Storage:

b

ased 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 (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

2

7

2

6

2

5

2

4

2

3

2

2

2

1

2

0

2

7

2

6

2

5

2

4

2

3

2

2

2

1

2

0

0

1

0

1

1

0

1

1

2

3

22212023222120

5

B

23222120232221200101

232221202322212001011011

161160

16

1

16

0

5

BSlide18

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

-1

00000000

11111111

2’s complement representationSlide19

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 = 23 + 21 = 10 (decimal)11110101 + 1 = 11110110 = -

10 (decimal)

11110110 flip + 1 = 00001001 + 1 = 00001010

Addition

:

-10 + 10

= 11110110

+ 00001010 = 0 (ignore overflow) Slide20

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

2

7

2

6

2

5

2

4

2

3

2

2

2

1

2

0

byte 3

byte 2

byte 1

byte 0

C:

i

ntSlide21

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

2

3

2

2

2

1

2

0

0

0

0

0

2

3

2

2

2

1

2

0

0

0

0

1

2

3

2

2

2

1

2

0

1

0

0

1

0

1

9

2

0

1

4

2 bytes (= 4 nibbles)

+

2

0

1

4

2.5 bytes (= 5 nibbles)

2

3222120110

0

C

232221201101Dcredit (+)debit (-)