2 - Haskell, Jeremy Jacobs PDF

Title 2 - Haskell, Jeremy Jacobs
Author William Macleod
Course Implementation of Programming Languages
Institution University of York
Pages 2
File Size 36.1 KB
File Type PDF
Total Downloads 3
Total Views 155

Summary

A less concise but more detailed set of notes of the lecture conducted by Jeremy Jacobs, got me 81/100 in the exam...


Description

2 - H%skell H%skell is % l%ngu%ge which m%kes it very e%sy to m%nipul%te strings %nd trees strings %re the concrete represent%tion of our progr%m typic%lly strings %re ch%r%cters, %nd we %re going to turn these strings of ch%r%cters into %bstr%ct synt%x trees H%skells l%ziness is v useful bec%use it lets us de%l with unbounded, infinitely long objects, %s long %s we only look %t % finite p%rt l%ter when we look %t optimis%tion, one of the optimis%tion techniques, we do % list of %pproxim%tions, %nd find %long this list, the %pproxim%tion we w%nt. the synt%x %nd type system helps us %void errors in h%skell %nd h%skell supports the technique of synt%x-direct progr%mming, useful for %n%lysing %bstr%ct synt%x trees H%skell progr%ms consist of expressions, which %re to be ev%lu%ted, such %s below t"ke four (filter is_even (m"p (*3) [0…])) — — [0, 6, 12, 18] if its in bold, it is % st%nd%rd function th%t is defined for us we t%ke the first four items, t%kes four things off the list which we get by filtering %nother list with the predic%te is_even, so only t%kes even numbers %nd the other list to be filtered is the list by m%pping the function (*3) over the infinite list which st%rts %t 0, %nd continues to infinity ([0…]) H%skell lets us do th%t bec%use its l%zy, it wont exp%nd this infinite list unless needed, however bec%use weʼve st%ted only four %re needed, it will stop exp%nding once four h%ve been done when writing definitions, you donʼt need to give % type in H%skell True ‘impliesʼ F%lse = F%lse _ ‘impliesʼ _ = True Donʼt h%ve to fill in the other 3 versions for implies, they %ll imply true H%skell is polymorphic for %n empty list, H%skell for most of the time will be %ble to work out its type ——— St%tic & Dyn%mic sem%ntics going to use form%l logic to describe how to build % type checker

the fin%l p%rt of the %n%lyse st%ge in the front end of % compiler is c%lled the st%tic sem%ntics, %ll of which is type checking why do we c%re %bout me%nings? bec%use we w%nt to get %ccess to % progr%ms me%ning two types of me%ning: – st%tic me%ning: ones th%t c%n be determined without executing the progr%m – dyn%mic me%ning: ones th%t c%n only be determined by executing the progr%m the st%tic sem%ntics lets us detect type errors, helps us spot errors the dyn%mic sem%ntics help us define wh%t we me%n by % compiler, %nd use this to help us design tests for the compiler —— proof rules this is the synt%x of % proof rule

n%me

Existing Judgement 1 … Existing Judgement n New judgement

[side conditions=

They %ll h%ve n%mes so we c%n refer to them the line is % node of % tree %bove the line %re things th%t h%ve been s%id to be true, they %re true judgements the bottom line is the new judgement th%t we h%ve come to on the f%r right,...


Similar Free PDFs