Prot ot ype in high-level language as execut able specif icat ion - - PowerPoint PPT Presentation

prot ot ype in high level language as execut able specif
SMART_READER_LITE
LIVE PREVIEW

Prot ot ype in high-level language as execut able specif icat ion - - PowerPoint PPT Presentation

Prot ot ype in high-level language as execut able specif icat ion Shigeru KUSAKABE, Keij iro Araki Kyushu Universit y, J apan I nt roduct ion High level programming languages support abst ract and rigorous descript ion st yles like f


slide-1
SLIDE 1

Prot ot ype in high-level language as execut able specif icat ion

Shigeru KUSAKABE, Keij iro Araki Kyushu Universit y, J apan

slide-2
SLIDE 2

I nt roduct ion

High level programming languages support abst ract and rigorous descript ion st yles like f ormal specif icat ion languages.

f ormal specif icat ion language high level programming language moderat ely abst ract , rigorous and execut able

abst ract det ailed

slide-3
SLIDE 3

Approach

Prot ot yping

Model in VDM language

VDMTools

Program in Haskell, a f unct ional language

compilers, in addit ion t o int erpret er libraries and t ools

slide-4
SLIDE 4

Quicksort in VDM++

qui cksor t : seq of nat

  • > seq of nat

qui cksor t ( l ) == cases l : [ ] - > [ ] ,

  • ^[ x] ^-
  • > qui cksor t

( [ y | y i n set el em s l & y < x] ) ^ [ x] ^ qui cksor t ( [ y | y i n set el em s l & y > x] ) end

slide-5
SLIDE 5

Quicksort in Haskell

qsor t : : O r d a => [ a] - > [ a] qsor t [ ] = [ ] qsor t ( x: xs) = qsor t el m _l t _x ++ [ x] ++ qsor t el m _gr eq_x wher e el m _l t _x = [ y | y <- xs, y < x] el m _gr eq_x = [ y | y <- xs, y >= x]

slide-6
SLIDE 6

Quicksort in C

qsor t ( a, l o, hi ) i nt a[ ] , hi , l o; { i nt h, l , p, t ; i f ( l o < hi ) { l = l o; h = hi ; p = a[ hi ] ; do { whi l e ( ( l < h) && ( a[ l ] <= p) ) l = l +1; whi l e ( ( h > l ) && ( a[ h] >= p) ) h = h- 1; i f ( l < h) { t = a[ l ] ; a[ l ] = a[ h] ; a[ h] = t ; } } whi l e ( l < h) ; t = a[ l ] ; a[ l ] = a[ hi ] ; a[ hi ] = t ; qsor t ( a, l o, l - 1 ) ; qsor t ( a, l +1, hi ) ; } }