general course information objectives · cse 5317/4305 l1: course organization and introduction 5...

8
CSE 5317/4305 L1: Course Organization and Introduction 1 CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers Leonidas Fegaras CSE 5317/4305 L1: Course Organization and Introduction 2 General Course Information Instructor: Leonidas Fegaras Office: ERB 653 (Engineering Research Bldg) Phone: (817) 272-3629 Email: [email protected] Office hours: Tuesday and Thursday 3:30-5:00pm Course web page: https://lambda.uta.edu/cse5317/ CSE 5317/4305 L1: Course Organization and Introduction 3 Catalogue Description Review of programming language structures, translation, and storage allocation. Introduction to context-free grammars and their description. Design and construction of compilers including lexical analysis, parsing and code generation techniques. Error analysis and simple code optimizations will be introduced. CSE 5317/4305 L1: Course Organization and Introduction 4 Objectives The goal of this course is to give a working knowledge of the basic techniques used in the implementation of modern programming languages. The course is centered around a substantial programming project: implementing a complete compiler for a realistic language. Students successfully completing this course will be able to apply the theory and methods learned during the course to design and implement optimizing compilers for most programming languages.

Upload: others

Post on 01-Jun-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: General Course Information Objectives · CSE 5317/4305 L1: Course Organization and Introduction 5 Outcome Upon successful completion ofthiscourse, students will gain an in-depth understanding

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

1

CS

E4

30

5:

Co

mpil

ers

for

Alg

ori

thm

ic L

angu

ages

CS

E5

31

7:

Des

ign a

nd C

on

stru

ctio

n o

fC

om

pil

ers

Leo

nid

as F

egar

as

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

2

Gen

eral

Co

urs

e In

form

atio

n

Inst

ruct

or:

Leo

nid

as F

egar

as

Off

ice:

ER

B 6

53

(E

ng

inee

rin

g R

esea

rch

Bld

g)

Ph

on

e:(8

17

) 2

72

-36

29

Em

ail:

feg

aras

@cs

e.u

ta.e

du

Off

ice

ho

urs

:T

ues

day

an

d T

hu

rsd

ay 3

:30

-5:0

0p

m

Co

urs

e w

eb p

ag

e:h

ttp

s://

lam

bd

a.u

ta.e

du

/cse

53

17

/

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

3

Cat

alog

ue

Des

crip

tio

n

•R

evie

w o

f p

rog

ram

min

g l

angu

age

stru

ctu

res,

tra

nsl

atio

n,

and

sto

rag

e al

loca

tio

n.

•In

tro

du

ctio

n t

o c

on

tex

t-fr

ee g

ram

mar

s an

d t

hei

r d

escr

ipti

on

.

•D

esig

n a

nd

co

nst

ruct

ion

of

com

pil

ers

incl

ud

ing

lex

ical

an

aly

sis,

par

sin

g a

nd

code

gen

erat

ion

tec

hn

iqu

es.

•E

rro

r an

aly

sis

and

sim

ple

co

de

op

tim

izat

ion

s w

ill

be

intr

od

uce

d.

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

4

Obje

ctiv

es

•T

he

go

al o

f th

is c

ou

rse

is t

o g

ive

a w

ork

ing

kn

ow

led

ge

of

the

bas

ic t

ech

niq

ues

use

d i

n t

he

imp

lem

enta

tio

n o

fm

od

ern

pro

gra

mm

ing

lan

gu

ages

.

•T

he

cou

rse

isce

nte

red

aro

un

d a

su

bst

anti

al p

rog

ram

min

gp

roje

ct:

imp

lem

enti

ng

aco

mp

lete

co

mp

iler

fo

r a

real

isti

c la

ng

uag

e.

•S

tud

ents

su

cces

sfu

lly

co

mp

leti

ng

th

is c

ou

rse

wil

l b

e ab

le t

o a

pp

ly

the

theo

ryan

dm

eth

od

s le

arn

ed d

uri

ng

the

cou

rse

to d

esig

n a

nd

imp

lem

ent

op

tim

izin

g c

om

pil

ers

for

mo

st p

rog

ram

min

g

lan

gu

ages

.

Page 2: General Course Information Objectives · CSE 5317/4305 L1: Course Organization and Introduction 5 Outcome Upon successful completion ofthiscourse, students will gain an in-depth understanding

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

5

Ou

tco

me

Up

on

su

cces

sfu

l co

mp

leti

on

of

this

cou

rse,

stu

den

ts

wil

l g

ain

an

in

-dep

th u

nd

erst

and

ing

of

man

yth

eore

tica

l an

d

pra

ctic

al a

spec

ts o

f m

od

ern

co

mp

iler

tec

hn

olo

gy

, in

clu

din

g

scan

nin

g,

par

sin

g,

typ

e-ch

eck

ing

, co

de

gen

erat

ion

an

d

op

tim

izat

ion

, an

d s

tora

ge

allo

cati

on

;

wil

l h

ave

the

skil

ls t

o d

esig

n a

nd

im

ple

men

t p

ract

ical

op

tim

izin

g c

om

pil

ers

for

pro

gra

mm

ing

lan

gu

ages

.

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

6

Rea

sons

toT

ake

this

Co

urs

e

•T

o u

nd

erst

and

bet

ter

–p

rog

ram

min

gla

ng

uag

es (

pri

nci

ple

s &

sem

anti

cs)

–co

mp

ute

r ar

chit

ectu

re a

nd

mac

hin

e co

de

stru

ctu

re

–th

e re

lati

on

bet

wee

n s

ou

rce

pro

gra

ms

and

gen

erat

edm

ach

ine

code

•T

o g

eta

go

od

bal

ance

of

theo

ry&

pra

ctic

e

•T

o c

om

ple

te a

su

bst

anti

al p

rog

ram

min

g p

roje

ct (

a co

mp

iler

fo

r a

real

isti

c la

ng

uag

e)

–to

get

pro

gra

mm

ing

ex

per

ien

cean

d b

eco

me

abet

ter

pro

gra

mm

er

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

7

Pre

requ

isit

es

•P

rere

qu

isit

es:

–C

SE

33

02

(Pro

gra

mm

ing

Lan

gu

ages

)

–C

SE

33

15

(Th

eore

tica

l C

on

cep

ts)

–C

SE

33

22

(Co

mp

ute

r A

rchit

ectu

re I

)

•S

tud

ents

mu

st:

–h

ave

kn

ow

led

ge

and

pro

gra

mm

ing

exp

erie

nce

wit

hJa

va;

–b

efa

mil

iar

wit

h t

he

fun

ctio

ns

of

mo

der

n c

om

pu

ter

arch

itec

ture

s an

d b

e

able

to p

rog

ram

in a

n a

ssem

bly

lan

gu

age;

–b

efa

mil

iar

wit

h d

ata

stru

ctu

re c

on

cep

ts a

nd

algo

rith

ms

(su

chas

lis

ts,

tree

s,

sort

ing

, h

ash

ing

, et

c).

•S

tud

ents

wit

ho

ut

adeq

uat

e p

rep

arat

ion

are

at

sub

stan

tial

ris

k o

f

fail

ing

th

is c

ou

rse.

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

8

Tex

tbo

ok

•R

equ

ired

Tex

tbo

ok

an

d N

ote

s:

–A

ndre

w W

. A

pp

el:

Mo

der

nC

om

pil

erIm

ple

men

tati

on i

n J

ava,

Sec

on

d

Ed

itio

n.

Cam

bri

dg

e U

niv

ersi

ty P

ress

, 2

00

2.

–L

ectu

re N

ote

s w

ill

be

avai

lab

leat

htt

ps:

//la

mb

da.

uta

.ed

u/c

se5

31

7/

•L

ectu

re s

lid

es a

re b

ased

on

no

tes

•Y

ou

may

fin

d t

he

foll

ow

ing

tex

ts u

sefu

l fo

r ad

dit

ion

al

bac

kg

rou

nd

an

d e

xp

lanat

ion:

–A

. V

. A

ho,

M.

S.

Lam

., R

. S

ethi,

an

d J

. D

. U

llm

an:

Co

mp

iler

s:P

rin

cip

les,

Tec

hniq

ues

, an

dT

oo

ls, 2

nd e

dit

ion

, (t

his

is

the

clas

sic

red

"Dra

go

n"

boo

k),

Ad

dis

on-W

esle

y, 2

00

7.

–C

. F

isch

er,

RC

ytr

on

, an

d R

. L

eBla

nc,

Cra

ftin

g a

Co

mp

iler

.

Bej

amin

/Cu

mm

ing

s, 2

00

9.

Page 3: General Course Information Objectives · CSE 5317/4305 L1: Course Organization and Introduction 5 Outcome Upon successful completion ofthiscourse, students will gain an in-depth understanding

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

9

Gra

din

g

•T

he

final

gra

de

wil

l be

bas

ed o

n

–40%

pro

ject

–25%

mid

term

exam

–35%

fin

al e

xam

(com

pre

hen

sive)

•T

he

cours

e w

ork

wil

l be

the

sam

efo

r gra

duat

esan

d u

nder

gra

duat

es.

•F

inal

gra

des

wil

l be

assi

gned

acc

ord

ing t

o t

he

foll

ow

ing s

cale

:

–A

: sc

ore

>=

90

–B

: 80 <

=sc

ore

<90

–C

: 70 <

=sc

ore

<80

–D

: 60 <

= s

core

< 7

0

–F

: sc

ore

<60

•S

om

etim

es,

I use

low

er c

uto

ff p

oin

ts,

dep

endin

g o

n t

he

over

all

per

form

ance

of

the

clas

s.

•A

fter

the

firs

t gra

des

are

post

ed,

you c

an c

hec

k y

our

gra

des

onli

ne

at t

he

cours

e w

eb

pag

e.

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

10

Rea

din

g A

ssig

nm

ents

•C

om

ple

tin

g r

eadin

g a

ssig

nm

ents

bef

ore

th

ecl

ass

per

iod

in

wh

ich

the

mat

eria

l is

dis

cuss

ed i

s es

sen

tial

to s

ucc

ess

in t

his

cla

ss.

•N

ot

all

the

assi

gn

ed m

ater

ial

wil

l b

e co

ver

ed i

n c

lass

, b

ut

yo

u

wil

l b

e re

spo

nsi

ble

fo

r it

on

exam

s.

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

11

Ex

ams

•B

oth

exam

sar

e o

pen

tex

tbo

ok

(o

nly

the

clas

s re

qu

ired

tex

tbo

ok

)

and

op

enno

tes

(all

no

tes

mu

st b

ese

cure

lyb

oun

d i

n o

ne

no

teb

oo

k).

Th

e fi

nal

ex

am w

ill

cov

er t

he

mat

eria

l fr

om

the

firs

t

lect

ure

up

to

an

d i

ncl

ud

ing

th

e la

st l

ectu

re.

•O

nce

th

e ex

amg

rad

es a

re p

ost

ed,

yo

u w

ill

hav

e 1

0 b

usi

nes

s d

ays

to d

isp

ute

yo

ur

gra

de

and

get

yo

ur

exam

re-

eval

uat

ed.

Bef

ore

yo

u

req

ues

t fo

r re

-ev

alu

atio

n,

mak

e su

re t

o c

om

par

e y

ou

r an

swer

wit

h

the

solu

tio

n.

No

re-

eval

uat

ion

wil

l b

e en

tert

ain

ed a

fter

th

e 1

0

day

per

iod

.

•N

o m

akeu

p e

xam

s w

ill

be

giv

en u

nle

ss t

her

e is

a j

ust

ifia

ble

reas

on

(su

ch a

s il

lnes

s, s

ick

nes

s o

r d

eath

in

the

fam

ily

).

If y

ou

mis

s an

ex

am a

nd

yo

uca

n p

rov

e th

at y

ou

r re

aso

n i

sju

stif

iab

le,

yo

u s

ho

uld

arr

ange

wit

h t

he

inst

ruct

or

to t

ake

the

mak

eup

ex

am

wit

hin

a w

eek

fro

m t

he

reg

ula

r ex

am t

ime.

Fo

r an

yo

ther

cas

e,

yo

u w

ill

get

a ze

ro g

rad

efo

r th

e m

isse

d e

xam

.C

SE

53

17

/43

05

L1

: C

ou

rse

Org

aniz

atio

n a

nd

In

tro

du

ctio

n1

2

Pro

ject

•T

he

cou

rse

pro

ject

is t

oco

nst

ruct

a c

om

pil

er f

or

a sm

all

pro

gra

mm

ing

lan

guag

e an

d w

ill

invo

lve:

lex

ical

an

aly

sis,

par

sin

g,

sem

anti

c an

aly

sis

(ty

pe-

chec

kin

g),

an

d c

od

eg

ener

atio

n

for

aM

IPS

arc

hit

ectu

re.

•D

etai

ls w

ill

be

giv

en o

ut

in c

lass

th

e th

ird

wee

k o

f th

e co

urs

e.

•T

his

pro

ject

wil

l b

e d

on

e in

Jav

a. Y

ou

may

use

yo

ur

ow

n P

C.

•T

he

pro

ject

is

to b

e co

mp

lete

d i

n s

even

sta

ges

sp

aced

th

rou

gh

ou

t

the

term

an

d w

ill

be

do

ne i

nd

ivid

uall

y.

•S

ub

mis

sio

ns

mu

st b

e d

on

e el

ectr

on

ical

ly u

sin

g t

he

clas

s w

eb s

ite

•L

ate

assi

gn

men

ts w

ill

be

mar

ked

20

po

ints

off

per

day

(o

ut

of

10

0 m

ax).

So

, th

ere

is n

o p

oin

t su

bm

itti

ng

a p

roje

ct r

epo

rt m

ore

than

4 d

ays

late

! T

his

pen

alty

can

no

t b

e w

aived

, u

nle

ss t

her

e

was

a c

ase

of

illn

ess

or

oth

er s

ub

stan

tial

im

ped

imen

t b

eyo

nd

you

r co

ntr

ol,

wit

h p

roo

f in

do

cum

ents

fro

m t

he

scho

ol.

Page 4: General Course Information Objectives · CSE 5317/4305 L1: Course Organization and Introduction 5 Outcome Upon successful completion ofthiscourse, students will gain an in-depth understanding

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

13

Ch

eati

ng

•P

roje

ctas

sig

nm

ents

mu

st b

e d

on

e in

div

idu

ally

. N

o c

op

yin

gis

per

mit

ted

. C

hea

tin

gin

vo

lves

giv

ing

ass

ista

nce

to

or

rece

ivin

g

assi

stan

ce f

rom

oth

er s

tud

ents

or

fro

m o

ther

in

div

idu

als,

co

py

ing

mat

eria

l fr

om

th

ew

eb,

etc.

•I

stri

ctly

ad

her

e to

th

e U

niv

ersi

ty o

f T

exas

at

Arl

ing

ton

rule

s an

d

gu

idel

ines

fo

r h

and

lin

gv

iola

tio

ns

of

acad

emic

dis

ho

nes

ty. P

leas

e

refe

r to

th

e p

amp

hle

t "C

HE

AT

ING

: D

efin

itio

ns

and

Co

nse

qu

ence

s" f

or

addit

ion

al I

nfo

rmat

ion

.

•If

an

y o

ne

is c

aug

ht

for

chea

tin

g,

or

ind

ulg

e in

pla

gia

rism

or

coll

usi

on

on

a p

rog

ram

min

g a

ssig

nm

ent

or

on

a e

xam

, th

e g

rad

e

for

the

enti

re c

ou

rse

wil

l b

ean

au

tom

atic

Fai

lgra

de

(F).

•Y

ou

are

req

uir

ed t

o s

ign

an

d r

eturn

th

e st

atem

ent

abo

ut

acad

emic

dis

ho

nes

ty

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

14

Sp

ecia

l A

ccom

mo

dat

ion

s

•If

yo

u r

equ

ire

an a

ccom

mo

dat

ion

bas

ed o

n d

isab

ilit

y,

I w

ou

ld

lik

e to

mee

t w

ith

yo

u i

nth

e p

riv

acy

of

my

off

ice,

du

ring

th

e fi

rst

wee

k o

fth

e se

mes

ter,

to

mak

e su

re y

ou

are

ap

pro

pri

atel

y

acco

mm

od

ated

.

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

15

Pro

ject

•T

he

pro

ject

wil

l b

e d

on

e in

div

idu

ally

.

•T

he

cou

rse

pro

ject

is

to c

on

stru

ct a

co

mp

iler

fo

r a

smal

l

pro

gra

mm

ing

lan

gu

age,

cal

led

PC

AT

.

•It

wil

l in

vo

lve:

–le

xic

al a

nal

ysi

s

–p

arsi

ng

–se

man

tic

anal

ysi

s (t

yp

e ch

eck

ing

)

–co

de

gen

erat

ion f

or

aM

IPS

arc

hit

ectu

re.

•T

he

pro

ject

is t

obe

com

ple

ted

in

sev

en s

tag

es s

pac

ed t

hro

ug

ho

ut

the

term

.

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

16

Su

rviv

al T

ips

•S

tart

wo

rkin

g o

n p

rog

ram

min

g a

ssig

nm

ents

as

soo

n a

s th

ey a

re

han

ded

ou

t. D

on

ot

wai

t ti

ll t

he

day

bef

ore

th

e d

ead

lin

e. Y

ou

wil

l

see

that

ass

ign

men

ts t

ake

mu

ch m

ore

tim

e w

hen

yo

u w

ork

on

them

und

er p

ress

ure

th

anw

hen

yo

u a

rem

ore

rela

xed

.

•D

esig

n c

aref

ull

y b

efo

re y

ou

co

de.

Wri

tin

g a

wel

l-d

esig

ned

pie

ce

of

cod

e is

alw

ays

easi

er t

han

star

tin

g w

ith

so

me

cod

e th

at "

alm

ost

wo

rks"

an

d a

ddin

g p

atch

es t

o m

ake

it "

real

ly w

ork

".

Page 5: General Course Information Objectives · CSE 5317/4305 L1: Course Organization and Introduction 5 Outcome Upon successful completion ofthiscourse, students will gain an in-depth understanding

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

17

Pla

tfo

rm a

nd

To

ols

•Y

ou

wil

l d

o y

ou

r p

roje

ct o

n y

ou

r o

wn

PC

(u

nd

er L

inu

x,

Win

do

ws,

Mac

OS

X,

etc)

or

on

om

ega

at U

TA

–Y

ou h

ave

to u

se J

ava

JDK

6(J

DK

7 m

ay n

ot

work

)

–T

her

e ar

e m

any o

n-l

ine

man

ual

s fo

rJa

va

(see

the

pro

ject

web

pag

e)

•T

o m

ake

cod

ing

eas

ier

in J

ava,

you

are

req

uir

ed t

o u

seth

e G

en

pac

kag

e to

bu

ild

ab

stra

ct s

yn

tax

tre

es a

nd

in

term

edia

te

rep

rese

nta

tio

n t

rees

.

•Y

ou

wil

l al

sou

se a

MIP

S c

od

e si

mula

tor,

cal

led

SP

IM,

to r

un

th

e

asse

mb

ly c

od

e g

ener

ated

by

yo

ur

com

pil

er

•T

o i

nst

all

the

pro

ject

on

you

r o

wn

Lin

ux

/Mac

OS

/Win

do

ws

PC

:

–in

stal

lS

un

's J

DK

6 (

the

Jav

a ru

nti

me/

com

pil

er)

–in

stal

lS

PIM

(th

e M

IPS

emu

lato

r)

–d

ow

nlo

ad t

he

pro

ject

an

d c

om

pil

e it

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

18

Pro

gra

m G

rad

ing

•P

rog

ram

s w

ill

be

gra

ded

acc

ord

ing

to

thei

r co

rrec

tnes

s, s

tyle

,an

d

read

abil

ity

.

•P

rog

ram

s sh

ou

ld b

ehav

e as

sp

ecif

ied

in

th

eas

sig

nm

ent

han

do

uts

.

•B

ad d

ata

sho

uld

be

han

dle

d g

race

full

y;

yo

ur

pro

gra

msh

ou

ld

nev

er h

ave

run

-tim

e er

rors

lik

e d

eref

eren

cin

g a

nu

ll p

oin

ter

or

usi

ng

an

ou

t-o

f-b

oun

ds

ind

ex.

•S

pec

ial

case

s sh

ou

ld b

e h

and

led

corr

ectl

y.

•U

nn

eces

sari

ly i

nef

fici

ent

alg

ori

thm

s o

r co

nst

ruct

s sh

ou

ld b

e

avoid

ed;

ho

wev

er,

effi

cien

cy s

hou

ld n

ever

be

pu

rsu

ed a

tth

e

expen

se o

f cl

arit

y o

r si

mp

lici

ty.

•P

rog

ram

s sh

ou

ld b

ew

ell

do

cum

ente

d,

mo

du

lar,

an

d f

lex

ible

, i.

e.

easy

to m

odif

y.

Ind

enta

tio

n s

ho

uld

refl

ect

pro

gra

mst

ruct

ure

. U

se

mea

nin

gfu

l id

enti

fier

s.

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

19

Pro

gra

m G

rad

ing

(co

nt.

)

•A

vo

id s

tati

c v

aria

ble

san

d s

ide

effe

cts

as m

uch

as

po

ssib

le.

Yo

u

shou

ld n

ever

use

sid

e ef

fect

s d

uri

ng

th

e se

man

tic

acti

on

sof

a

par

ser.

•T

he

gra

der

sh

ou

ld b

e ab

le t

o u

nd

erst

and

th

e p

rog

ram

wit

ho

ut

un

du

e st

rain

.

•I

wil

l p

rov

ide

som

e te

st p

rog

ram

s, b

ut

thes

e p

rog

ram

sw

ill

no

t

test

yo

ur

com

pil

er e

xh

aust

ivel

y.

It i

s y

ou

r re

spo

nsi

bil

ity

to

tes

t

ever

y s

tate

men

t in

yo

ur

pro

gra

m b

y s

om

e p

iece

of

test

dat

a.

Th

oro

ug

h t

esti

ng

is

esse

nti

al t

o e

stab

lish

th

e re

liab

ilit

y o

f y

ou

r

code.

•D

on

't ev

en t

hin

k a

bo

ut

add

ing

fan

cy f

eatu

res

un

til

the

req

uir

ed

wo

rk i

s co

mple

tely

deb

ug

ged

. A

corr

ectl

y w

ork

ing

sim

ple

pro

gra

m i

s w

ort

hm

uch

mo

re (

both

in

th

is c

lass

an

din

act

ual

pra

ctic

e) t

han

a f

ancy

pro

gra

mw

ith

bu

gs.

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

20

Ch

eati

ng

•P

roje

ctas

sig

nm

ents

mu

st b

e d

on

e in

div

idu

ally

. N

o c

op

yin

gis

per

mit

ted

.

•C

hea

tin

g i

nv

olv

es g

ivin

g a

ssis

tan

ce t

o o

r re

ceiv

ing

ass

ista

nce

fro

m o

ther

stu

den

ts o

r fr

om

oth

er i

ndiv

idu

als,

co

py

ing

mat

eria

l

fro

m t

he

web

, et

c.

•Y

ou

are

req

uir

ed t

o u

se t

he

Gen

pac

kag

e fo

r tr

ee c

on

stru

ctio

n

and

pat

tern

mat

chin

g.

It w

ill

be

taken

as c

hea

tin

g i

f y

ou

use

yo

ur

ow

n d

ata

stru

ctu

res

or

inte

rfac

e (s

ince

th

is w

ou

ld m

ean

th

aty

ou

hav

e co

pie

d t

he

cod

e fr

om

els

ewh

ere)

.

•T

he

pu

nis

hm

ent

for

chea

tin

g i

s a

zero

in

th

e as

sig

nm

ent

and

wil

l

be

sub

ject

to

the

un

iver

sity

's a

cad

emic

dis

ho

nes

typ

oli

cy.

•If

yo

u h

ave

any

qu

esti

on

s re

gar

din

gan

assi

gn

men

t, s

ee t

he

inst

ruct

or

or

teac

hin

g a

ssis

tant.

Page 6: General Course Information Objectives · CSE 5317/4305 L1: Course Organization and Introduction 5 Outcome Upon successful completion ofthiscourse, students will gain an in-depth understanding

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

21

Del

iver

able

s

•P

roje

ct p

has

es:

–L

exic

al A

nal

ysi

s:

wort

h 6

% o

f y

our

pro

ject

gra

de.

–P

arsi

ng:

wort

h 1

4%

of

your

pro

ject

gra

de.

–A

bst

ract

Sy

nta

x:

wort

h 1

4%

of

your

pro

ject

gra

de.

–T

yp

e-C

hec

kin

g:

wort

h 1

8%

of

your

pro

ject

gra

de.

–S

imple

IR

s: w

ort

h 1

8%

of

your

pro

ject

gra

de.

–R

est

of

IRs:

wort

h 1

6%

of

your

pro

ject

gra

de.

–In

stru

ctio

n S

elec

tio

n:

wort

h 1

4%

of

your

pro

ject

gra

de.

•T

he

du

e ti

me

of

each

pro

ject

is t

he

mid

nig

ht

of

the

ind

icat

ed d

ue

day

•Y

ou w

ill

han

d-i

n y

ou

rp

roje

ct s

ou

rce

code

elec

tron

ical

ly

•Y

ou m

ay h

and

-in

yo

ur

sou

rce

file

s as

man

y t

imes

as

yo

u w

ant;

on

ly t

he

last

one

wil

lb

eta

ken

in

to a

cco

un

t

•L

ate

pro

ject

s w

ill

be

mar

ked

20

po

ints

off

per

day

(ou

t o

f1

00

max

). S

o,

ther

e

is n

o p

oin

tsu

bm

itti

ng a

pro

ject

mo

re t

han

4 d

ays

late

!

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

22

So

luti

on

•T

her

e is

a s

olu

tio

n j

ar a

rch

iveSolution.jar

–It

pro

vid

es a

ll t

he

clas

ses

(ob

fusc

ated

), s

o y

ou

can

com

par

e th

e o

utp

ut

of

yo

ur

pro

gra

m w

ith

th

at o

fth

e so

luti

on

.

–F

or

each

pro

ject

ph

ase,

yo

u c

an c

om

par

e th

eou

tpu

t o

f yo

ur

pro

gra

m w

ith

that

of

the

solu

tio

n.

•Y

ou

can

run

the

solu

tio

n P

CA

T c

om

pil

er o

ver

a t

est

PC

AT

pro

gra

m,

saytests/hanoi.pcat

, u

sin

g t

he

com

man

d

solution 7 hanoi

insi

de

yo

ur

pro

ject

dir

ecto

ry.

•If

yo

u m

ess

up

a p

roje

ct p

has

e y

ou

can

sti

ll d

oth

e n

ext

pro

ject

ph

ases

by

rem

ov

ing

the

app

rop

riat

e so

urc

e fi

les

fro

m y

ou

r

dir

ecto

ry.

–T

hat

way

, th

em

issi

ng

cla

sses

wil

l b

e co

pie

d f

rom

th

eSolution.jar

file

, ra

ther

than

co

mpil

edfr

om

yo

ur

sou

rces

.

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

23

Wh

atis

a C

om

pil

er?

•W

e w

ill

mo

stly

stu

dy

:

hig

h-l

evel

sou

rce

cod

e

low

-lev

el

mac

hin

e co

de

com

pil

er

eg,

Jav

apro

gra

m

easy

to u

nder

stan

d

use

r-fr

iendly

sy

nta

x

man

yhig

h-l

evel

pro

gra

mm

ing c

onst

ruct

s

mac

hin

e-in

dep

enden

t

var

iable

s, p

roce

dure

s, c

lass

es,

...

eg, M

IPS

cod

e

har

d t

o u

nder

stan

d

spec

ific

to

har

dw

are

regis

ters

& u

nnam

ed l

oca

tions

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

24

Arc

hit

ectu

re

Co

mp

iler

:

Inte

rpre

ter:

sou

rce

pro

gra

mco

mpil

eras

sem

ble

rli

nker

load

er

asse

mbly

cod

em

achin

eco

de

mac

hin

eco

de

lib

rari

esd

ata

resu

lt

inte

rpre

ter

dat

a

resu

ltso

urc

epro

gra

m

Jav

a u

ses

bo

tha

com

pil

er (

jav

ac)

and

an

in

terp

rete

r (j

ava)

Page 7: General Course Information Objectives · CSE 5317/4305 L1: Course Organization and Introduction 5 Outcome Upon successful completion ofthiscourse, students will gain an in-depth understanding

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

25

Man

y O

ther

Tra

nsl

ato

rs

Sou

rce

Lan

gu

age

Tra

nsl

ato

rT

arg

et

Lan

gu

age

LaT

eXT

ext

Form

ater

Post

Scr

ipt

SQ

Ldat

abas

e quer

yopti

miz

erQ

uer

yE

val

uat

ion P

lan

Java

javac

com

pil

erJa

va

by

te c

ode

Java

cro

ss-c

om

pil

erC

++

code

Engli

sh t

ext

Nat

ura

l L

ang U

nder

stan

din

gse

man

tics

(mea

nin

g)

Reg

ula

r E

xpre

ssio

ns

JLex

scan

ner

gen

erat

or

a sc

anner

in J

ava

BN

Fof

a la

nguag

eC

UP

par

ser

gen

erat

or

a par

ser

inJa

va

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

26

Ch

alle

ng

es

•M

any

var

iati

on

s:

–m

any

pro

gra

mm

ing

lan

guag

es (

eg,

FO

RT

RA

N,

C+

+,

Jav

a)

–m

any

pro

gra

mm

ing

par

adig

ms

(eg

, o

bje

ct-o

rien

ted,

fun

ctio

nal

, lo

gic

)

–m

any

com

pu

ter

arch

itec

ture

s (e

g,

MIP

S,

SP

AR

C,

Inte

l, a

lph

a)

–m

any

oper

atin

g s

yst

ems

(eg

, L

inu

x,

So

lari

s, W

ind

ow

s)

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

27

Qual

itie

s o

f a

Co

mp

iler

•th

e co

mp

iler

its

elf

mu

st b

e b

ug

-fre

e

•it

mu

st g

ener

ate

corr

ect

mac

hin

e co

de

•th

e g

ener

ated

mac

hin

e co

de

mu

st r

un

fas

t

•th

e co

mp

iler

its

elf

mu

st r

un

fas

t (c

om

pil

atio

n t

ime

mu

st b

e

pro

po

rtio

nal

to

pro

gra

m s

ize)

•th

e co

mp

iler

mu

st b

e p

ort

able

(ie

, m

od

ula

r, s

up

po

rtin

g s

epar

ate

com

pil

atio

n)

•it

mu

st p

rin

tgo

od

dia

gn

ost

ics

and

err

or

mes

sag

es

•th

e g

ener

ated

co

de

mu

st w

ork

wel

l w

ith

ex

isti

ng

deb

ug

ger

s

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

28

Ch

alle

ng

es

•B

uil

din

g a

co

mp

iler

req

uir

es k

no

wle

dg

e o

f

–p

rog

ram

min

gla

ng

uag

es (

par

amet

erpas

sing

, v

aria

ble

sco

pin

g,

mem

ory

allo

cati

on,

etc)

–th

eory

(au

tom

ata,

co

nte

xt-

free

lang

uag

es,

etc)

–al

gori

thm

s an

d d

ata

stru

cture

s (h

ash t

able

s, g

rap

h a

lgo

rith

ms,

dyn

amic

pro

gra

mm

ing

, et

c)

–co

mp

ute

r ar

chit

ectu

re (

asse

mb

lypro

gra

mm

ing

)

–so

ftw

are

eng

inee

rin

g

Page 8: General Course Information Objectives · CSE 5317/4305 L1: Course Organization and Introduction 5 Outcome Upon successful completion ofthiscourse, students will gain an in-depth understanding

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

29

Ad

dre

ssin

g P

ort

abil

ity

•S

up

po

se y

ou

wan

tto

wri

te c

om

pil

ers

fromm

so

urc

e la

ng

uag

es t

o

n c

om

pu

ter

pla

tfo

rms.

A n

aïv

e so

luti

on

req

uir

esn*m

pro

gra

ms:

C+

+M

IPS

Jav

aS

PA

RC

Pen

tiu

m

FO

RT

RA

NP

ow

erP

C

•b

ut

we

can

do

it

wit

h n+m

pro

gra

ms:

C+

+

M

IPS

Java

SP

AR

C

Pen

tium

FO

RT

RA

N

P

ow

erP

C

FE

FE

FE

BE

BE

BE

BE

IR

–IR

:In

term

edia

te R

epre

sen

tati

on

–F

E:

Fro

nt-

En

d

–B

E:

Bac

k-E

nd

CS

E 5

31

7/4

30

5

L

1:

Co

urs

e O

rgan

izat

ion

an

d I

ntr

od

uct

ion

30

Ph

ases

•A

ty

pic

al r

eal-

wo

rld

co

mp

iler

usu

ally

has

mu

ltip

le p

has

es

•T

he

fro

nt-

end

co

nsi

sts

of

the

foll

ow

ing

ph

ases

:

–sc

an

nin

g:

asc

ann

er g

rou

ps

inp

ut

char

acte

rs i

nto

to

ken

s

–p

ars

ing

: a

par

ser

reco

gn

izes

seq

uen

ces

of

tok

ens

acco

rdin

gto

so

me

gra

mm

ar a

nd g

ener

ates

Ab

stra

ct S

ynta

xT

rees

(A

ST

s)

–se

ma

nti

c a

na

lysi

s: p

erfo

rms

typ

ech

eck

ing

and

tran

slat

es A

ST

s in

to I

Rs

–o

pti

miz

ati

on

:op

tim

izes

IR

s

•T

he

bac

k-e

nd

co

nsi

sts

of

the

foll

ow

ing

ph

ases

:

–in

stru

ctio

n s

elec

tio

n:

map

s IR

s in

to a

ssem

bly

co

de

–co

de

op

tim

iza

tio

n:

op

tim

izes

th

e as

sem

bly

co

de

usi

ng c

on

tro

l-fl

ow

and

dat

a-fl

ow

an

alyse

s, r

egis

ter

allo

cati

on

, et

c

–co

de

emis

sio

n:

gen

erat

es m

ach

ine

code

fro

m a

ssem

bly

co

de