Programming languages shape computational thinking
-
Upload
eelco-visser -
Category
Technology
-
view
675 -
download
1
description
Transcript of Programming languages shape computational thinking
![Page 1: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/1.jpg)
Challenge the future 1
`Programming Languages shape Computational Thinking’
Intreerede prof. dr. Eelco VisserHoogleraar Programming Languages
17 Januari 2014
![Page 2: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/2.jpg)
repeat n times variation-of(same-argument)
for(p in important-people) thank-you(p)
for(p in audience) individual-quiz(p)
def same-argument = “Programming Languages shape Computational Thinking”
This Lecture
![Page 3: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/3.jpg)
Automatisering beperkt wachttijd rijexamen
Kosten automatisering overheid stijgen snel
Artsen bekijken nut computer
Automatisering landbouw teveel zaak van koplopers
De PC, een algemeen gebruikt, maar toch ingewikkeld gereedschap
Grote behoefte aan personeel automatisering
Ondernemingsraden in banksector willen automatisering onder controle krijgen
Automatisering politie is verkapte bezuiniging
Vrouw en computer
Werknemers onvoldoende bij automatisering betrokken
Automatisering mislukt bij helft bedrijven
Mensen zijn geen verlengstuk van de computer
Source: http://kranten.kb.nl
![Page 4: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/4.jpg)
Software systems are the engines of modern information society
![Page 5: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/5.jpg)
Software systems are for people
![Page 6: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/6.jpg)
Software should ‘just work’
easy to usesafecheap (free!)responsive scalereliabledon’t lose datakeep data privatehelp catch terrorists
![Page 7: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/7.jpg)
Software is encoded computational thinking
software
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
![Page 8: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/8.jpg)
Software engineers are the architects and mechanics of modern information society
computer user
softwareengineer
software
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
![Page 9: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/9.jpg)
Software engineering provides the tools that let software engineers do a good job
design patternsbest practicescoding standardscode reviewspair programming(unit) testingdebugging
computer user
softwareengineer
software
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
![Page 10: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/10.jpg)
Programming languages are the key tools in the encoding process
computer user
softwareengineer
software
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
programminglanguage
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
![Page 11: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/11.jpg)
Programming languages are software systems too
computer user
softwareengineer
software
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
programminglanguage
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
compilerinterpretertype checkereditor (IDE)refactoringsbug finders
![Page 12: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/12.jpg)
Programming languages should ‘just work’
computer user
softwareengineer
software
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
programminglanguage
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
easy to usesafecheap (free!)responsive scalereliable
![Page 13: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/13.jpg)
Language designers create programming languages
computer user
softwareengineer
language designer
software
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
programminglanguage
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
![Page 14: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/14.jpg)
computer user
softwareengineer
language designer
software
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
programminglanguage
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
Language engineering provides the tools that let language designers do a good job
![Page 15: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/15.jpg)
computer user
softwareengineer
language designer
software
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
programminglanguage
meta-language
Meta-languages support the encoding of language designs
language engineer
![Page 16: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/16.jpg)
computer user
softwareengineer
language designer
software
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
programminglanguage
Language engineers eat their own dogfood
language engineer
meta-language
![Page 17: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/17.jpg)
Software is encoded computational thinking
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
![Page 18: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/18.jpg)
Alan Turing1912 - 1954
Software is encoded computational thinking
modeling mechanical computation
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
![Page 19: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/19.jpg)
$0100$ 1100
$0000$ 1010
$01$01
122233
$01$01
RRLRLL
223H33
$3 $ R 4
Alan Turing1936
Turing Machine
currentstate
currentsymbol new
symbol
movetape
nextstate
2
3
statetapecurrent
Church-Turing Thesis: Any effective computation can be expressed with a Turing Machine
![Page 20: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/20.jpg)
$0100$ 1100
01$10
44455
10$01
RRLLL
4455
01$01$
666777
01$10$
LLRRRR
667778
subtract one
6
$0000$ 1010
$01$01
122233
$01$01
RRLRLL
223H33
$3 $ R 4
is zero?
01$10
88899
01$01
RRLLL
889910
add one
010 0 L 10110 1 L 10$10 $ L 11011 0 L 11111 1 L 11$12 $ R 2
back
repeat
Add two binary
numbers
1
H
Alan Turing1936
Turing Machine
Church-Turing Thesis: Any effective computation can be expressed with a Turing Machine
![Page 21: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/21.jpg)
Alan Turing1936
Universal Turing Machine
$program Sdata
Universal Program(Turing Machine
Interpreter)
Halting problem: given a Turing Machine program P, does P halt for any input data?
Undecidable!
![Page 22: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/22.jpg)
Von Neumann
Simple Instructions add, subtractfetch, store
…
data
bus
program
memoryCPU
registers
controlunit
ALU
world
Alan Turing
![Page 23: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/23.jpg)
Example: a procedure for computing Fibonacci numbers
n n-th fibonacci
0 1
1 1
2 2 = 1 + 1
3 3 = 1 + 2
4 5 = 2 + 3
5 8 = 3 + 5
6 13 = 5 + 8
7 21 = 8 + 13
8 34 = 13 + 21
![Page 24: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/24.jpg)
Example: a procedure for computing Fibonacci numbers
n n-th fibonacci
0 1
1 1
2 2 = 1 + 1
3 3 = 1 + 2
4 5 = 2 + 3
5 8 = 3 + 5
6 13 = 5 + 8
7 21 = 8 + 13
8 34 = 13 + 21
![Page 25: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/25.jpg)
by calling _fib
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
compute n-th fibonacci number
compute (n-2)-nd fibonacci number
compute (n-1)-th fibonacci number
add the results
return to caller
n n-th fibonacci
0 1
1 1
2 2 = 1 + 1
3 3 = 1 + 2
4 5 = 2 + 3
5 8 = 3 + 5
6 13 = 5 + 8
7 21 = 8 + 13
8 34 = 13 + 21
by calling _fib
if n less or equal to 1 result is 1
![Page 26: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/26.jpg)
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
call procedure procedure callpass argument(s)
get return value
procedure entry
set up stack frame
unwind stackreturn to caller
return value
get argument(s)procedure definition
call procedure procedure callpass argument(s)
get return value
procedure haslabel _fib
pass argument in %edi register
pass return value in %eax register
use 16 bytes forstack frame
The Procedure Design Pattern
![Page 27: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/27.jpg)
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
procedure entry
call procedure procedure call
set up stack frame
unwind stackreturn to caller
return value
get argument(s)
pass argument(s)
get return value
procedure definition
call procedure procedure callpass argument(s)
get return value
design patternsbest practicescoding standardscode reviewspair programming(unit) testingbug findersprogram annotationsdebugging
![Page 28: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/28.jpg)
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1);}
Procedural Abstraction
The C Programming Language - Kernighan & Ritchie (1988)
A declarative language for specifying procedures
![Page 29: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/29.jpg)
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1);}
Procedural Abstraction
Procedure design pattern captured in linguistic abstraction
proceduredefinition
procedurecall
![Page 30: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/30.jpg)
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1);}
Procedural Abstraction
compute n-th fibonacci number
compute (n-2)-th fibonacci number
compute (n-1)-th fibonacci number
add resultsreturn to caller
Self explanatory code!
n n-th fibonacci
0 1
1 1
2 2 = 1 + 1
3 3 = 1 + 2
4 5 = 2 + 3
5 8 = 3 + 5
6 13 = 5 + 8
7 21 = 8 + 13
8 34 = 13 + 21
![Page 31: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/31.jpg)
int fib(int n) { if(n <= 1) return “1”; else return fib(n, 2) + fob(n - 1);}
Procedural Abstraction
Automatic consistency checks!
There is no procedure ‘fob’
Should return int not string
Expecting 1 argument, not 2
![Page 32: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/32.jpg)
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1);}
Procedural Abstraction
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
gcc
Automatic generation of correct code!
![Page 33: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/33.jpg)
Procedural Abstraction
Reasoning about behaviour!
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1);}
Yes, but it is not a very responsive implementation of Fibonacci; its complexity is O(2^n)
design patternsbest practices
coding standardscode reviews
pair programming(unit) testingbug finders
program annotationsdebugging
Is this a correct implementation of Fibonacci?
![Page 34: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/34.jpg)
ProblemDomain
SolutionDomain
![Page 35: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/35.jpg)
IntermediateLanguage
linguistic abstraction | liNGˈgwistik abˈstrakSHən |noun1. a programming language construct that captures a programming
design pattern the linguistic abstraction saved a lot of programming effort he introduced a linguistic abstraction for page navigation in web programming
2. the process of introducing linguistic abstractions linguistic abstraction for name binding removed the algorithmic encoding of name resolution
ProblemDomain
SolutionDomain
![Page 36: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/36.jpg)
Procedural abstraction
Structured control-flow
Automatic memory management
Data abstraction
Modules
and many more
![Page 37: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/37.jpg)
Church-Turing Thesis++: Any effective computation can be expressed with a C program
![Page 38: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/38.jpg)
“A programming language is low level when its programs require attention to the irrelevant”. -- Alan Perlis, 1982
![Page 39: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/39.jpg)
![Page 40: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/40.jpg)
“The enormous growth in data leads to large underlying graphs which require huge amounts of computational power to analyze. While modern commodity computer systems provide a significant amount of computational power measured in the tera-flops, efficient execution of graph analysis algorithms on large datasets remains difficult on these systems [26]. ... it is often challengingto implement a graph analysis algorithm in an efficient way.”
Sungpack Hong et al. (2012)
![Page 41: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/41.jpg)
Zef Hemel, Danny M. Groenewegen, Lennart C. L. Kats, Eelco Visser. Static consistency checking of web applications with WebDSL. Journal of Symbolic Computation, 46(2):150-182, 2011.
Late Failure Detection in Web Applications
browser server database
Java SQLHTML, JS, CSS
Data Persistence
Access Control Injection Attacks
Search
XSSData Validation
Data Binding
Routing
... ...
![Page 42: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/42.jpg)
parallel programming (multi-core machines)
distributed systems (web, mobile)
data persistence / services / invariants
security / authentication / authorization / access control
embedded software (resource constraints)
big data analytics (scalability)
programming quantum computers
![Page 43: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/43.jpg)
“A programming language is low level when its programs require attention to the irrelevant”. -- Alan Perlis, 1982
ProblemDomain
SolutionDomain
General-Purpose
Language
![Page 44: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/44.jpg)
SolutionDomain
ProblemDomain
Domain-specific language (DSL) noun1. a programming language that provides notation, analysis,
verification, and optimization specialized to an application domain2. result of linguistic abstraction beyond general-purpose computation
General-Purpose
Language
Domain-Specific
Language
![Page 45: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/45.jpg)
Markus Püschel
![Page 46: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/46.jpg)
Green-Marl: A DSL for Easy and Efficient Graph AnalysisSungpack Hong, Hassan Chafi, Eric Sedlar, Kunle Olukotun (ASPLOS 2012)
![Page 47: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/47.jpg)
WebDSL: tier-less web programmingSeparation of Concerns & Linguistic Integration
entity Status { text : WikiText author : Person validate(text.length() <= 140, "Message can only be 140 characters")}extend entity Person { following : Set<Person>}
data model with invariants (automatic data persistence)
function searchPerson(name: String, lim: Int) : List<Person> { return select p from Person as p where p.name like ~("%" + name + "%") limit ~lim;}
integrated queries (prevent injection attacks)
template output(p: Person) { navigate profile(p) { output(p.name) }}page profile(p: Person) { // page body}
statically checked navigation
template update() { var status := Status{ author := principal() } form{ input(status.text) submit action{} { "Share" } }}
model-view pattern (no controllers)
![Page 48: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/48.jpg)
SolutionDomain
ProblemDomain
General-Purpose
Language
Domain-Specific
Language
![Page 49: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/49.jpg)
Making programming languages is probably very expensive?
SolutionDomain
ProblemDomain
General-Purpose
Language
Domain-Specific
Language
![Page 50: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/50.jpg)
General-Purpose
Language
Making programming languages is probably very expensive?
SolutionDomain
ProblemDomain
General-Purpose
Language
Domain-Specific
Language
LanguageDesign
Compiler +Editor (IDE)
![Page 51: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/51.jpg)
Compiler +Editor (IDE)
Meta-Linguistic Abstraction
LanguageDesign
General-Purpose
Language
Declarative-Meta
Languages
SolutionDomain
ProblemDomain
General-Purpose
Language
Domain-Specific
Language
LanguageDesign
![Page 52: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/52.jpg)
Compiler +Editor (IDE)
LanguageDesign
Declarative-Meta
Languages
![Page 53: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/53.jpg)
Language Workbench
Language Design
SyntaxDefinition
NameBinding
TypeSystem
DynamicSemantics
Transforms
Meta-DSLs
Compiler +Editor (IDE)
![Page 54: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/54.jpg)
Spoofax Language Workbench
Language Design
SyntaxDefinition
NameBinding
TypeSystem
DynamicSemantics
Transforms
SDF3 Stratego Transformation Language
Compiler +Editor (IDE)
declarative rule-based language definition
![Page 55: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/55.jpg)
Spoofax Language Workbench
Language Design
SyntaxDefinition
NameBinding
TypeSystem
DynamicSemantics
Transforms
Syntax Definition with SDF3
Stratego Transformation Language
Compiler +Editor (IDE)
![Page 56: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/56.jpg)
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1);}
Syntax: Phrase Structure of Programs
![Page 57: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/57.jpg)
Syntax: Phrase Structure of Programs
}
int fib ( int n ) {if ( n <= 1 )
return 1 ;else
return fib ( n - 2 ) + fib ( n - 1 ) ;
![Page 58: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/58.jpg)
Exp.IntExp.Int
Exp.Leq Statement.Return Exp.Sub Exp.Sub
Exp.Call Exp.Call
Exp.Add
Statement.Return
Param.Param
IntType
Definition.Function
Statement.If
ID
}int fib ( int n ) { if ( n <= 1 ) return 1 ; else return fib ( n - 2 ) + fib ( n - 1 ) ;
Exp.IntExp.Var Exp.IntExp.VarExp.VarIntType
Syntax: Phrase Structure of Programs
![Page 59: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/59.jpg)
Function
IntType IntType
Param
Var Int Int
Leq Return
Return
Call
Add
Var Int
Sub
Var Int
Sub
Call
If
fib n n 1 1 fib n 2 fib n 1
AbstractSyntaxTree
![Page 60: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/60.jpg)
Function( IntType(), "fib", [Param(IntType(), "n")], [ If( Leq(Var("n"), Int("1")) , Int("1") , Add( Call("fib", [Sub(Var("n"), Int("2"))]) , Call("fib", [Sub(Var("n"), Int("1"))]) ) ) ])
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1);}
Abstract Syntax Term
Text
parse
![Page 61: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/61.jpg)
Type
Definition.Function
ID }( ) {Param* Statement*
Exp
Statement.Return
return ;
Statement.If
if ( ) elseExp Statement Statement
Exp.Add
+Exp Exp
Exp.Var
ID
Understanding Syntax =Understanding Tree Structure
parse(prettyprint(t)) = t
No need to understand how parse works!
![Page 62: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/62.jpg)
Type
Definition.Function
ID }( ) {Param* Statement*
Exp
Statement.Return
return ;
Statement.If
if ( ) elseExp Statement Statement
Exp.Add
+Exp Exp
templates Definition.Function = < <Type> <ID>(<Param*; separator=",">) { <Statement*; separator="\n"> } >
Statement.If = < if(<Exp>) <Statement> else <Statement> >
Statement.Return = <return <Exp>;>
Exp.Add = <<Exp> + <Exp>>
Exp.Var = <<ID>> Exp.Var
ID
The Syntax Definition Formalism SDF3
![Page 63: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/63.jpg)
Demo: Syntax Definition in the Spoofax Language Workbench
![Page 64: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/64.jpg)
Statement.If = < if(<Exp>) <Statement> else <Statement>>
Parser
Abstract syntax tree schema
Pretty-Printer
Syntactic completion templates
Folding rules
Error recovery rules
Syntactic coloring
Outline rules
Syntax Definition
Multi-Purpose Declarative Syntax Definition
![Page 65: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/65.jpg)
ChomskyBackus, NaurTomitaHeering, Hendriks, Klint, RekersRekersVisserVisservan den Brand, Scheerder, Vinju, VisserBravenboer, VisserKallebergBravenboer, Dolstra, VisserKats, VisserErdweg, Rendel, Kästner, OstermannDe Jonge, Kats, Visser, SöderbergVollebregt, Kats, VisserErdweg, Rendel, Kästner, Ostermann
Context-free GrammarsBNF
Tomita parsingThe Syntax Definition Formalism SDF
Generalized LR ParsingCharacter level grammars (SDF2)
Scannerless Generalized LR ParsingDisambiguation filters
Language embeddingSGLR in Java (JSGLR)
Preventing injection attacksThe Spoofax Language Workbench
Library-based syntactic language extensibility (SugarJ)Error recovery for SGLR
Template-based grammar productions (SDF3)Layout sensitive generalized parsing
A very incomplete history of SDF
1956196319851988199219951997200220042006201020102011201220122012
![Page 66: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/66.jpg)
Spoofax Language Workbench
Language Design
SyntaxDefinition
NameBinding
TypeSystem
DynamicSemantics
Transforms
Syntax Definition with SDF3
Stratego Transformation Language
Compiler +Editor (IDE)
![Page 67: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/67.jpg)
Spoofax Language Workbench
Language Design
SyntaxDefinition
NameBinding
TypeSystem
DynamicSemantics
Transforms
incremental analysis & transformation
SDF3 Stratego Transformation Language
Compiler +Editor (IDE)
verification of language design consistency
![Page 68: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/68.jpg)
A Language Designer’s Workbench
Language Design
SyntaxDefinition
NameBinding
TypeSystem
DynamicSemantics
Transforms
SDF3 Stratego
ConsistencyProof
NaBL TS DynSem
ResponsiveEditor (IDE) Tests
IncrementalCompiler
more declarativemeta-languages
automaticverification
![Page 69: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/69.jpg)
A Language Designer’s Workbench
Language Design
SyntaxDefinition
NameBinding
TypeSystem
DynamicSemantics
Transforms
SDF3 Stratego
ConsistencyProof
TS DynSem
TestsResponsiveEditor (IDE)
IncrementalCompiler
Name Bindingwith NaBL
![Page 70: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/70.jpg)
Name Binding & Scope Rules
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1);}
what does this variable refer to?
Our contribution
- declarative language for name binding & scope rules- generation of incremental name resolution algorithm
- Konat, Kats, Wachsmuth, Visser (SLE 2012)- Wachsmuth, Konat, Vergu, Groenewegen, Visser (SLE 2013)
which function is being called here?
Needed for
- checking correct use of names and types- lookup in interpretation and compilation- navigation in IDE- code completion
State-of-the-art
- programmatic encoding of name resolution algorithms
![Page 71: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/71.jpg)
Definitions and References
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1);}
binding rules
Param(t, name) : defines Variable name Var(name) : refers to Variable name
Var(“n”)
Param(IntType(), “n”)
![Page 72: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/72.jpg)
Definitions and References
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1);}
Call(“fib”, […])
Function(IntType(), “fib”, […], If(…))binding rules
Param(t, name) : defines Variable name Var(name) : refers to Variable name
Function(t, name, param*, s) : defines Function name Call(name, exp*) : refers to Function name
![Page 73: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/73.jpg)
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1); }
int power(int x, int n) { if(x <= 0) return 1; else return x * power(x, n - 1);}
Scope
binding rules
Param(t, name) : defines Variable name Var(name) : refers to Variable name
Function(t, name, param*, s) : defines Function name Call(name, exp*) : refers to Function name
![Page 74: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/74.jpg)
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1); }
int power(int x, int n) { if(x <= 0) return 1; else return x * power(x, n - 1);}
Scope
binding rules
Param(t, name) : defines Variable name Var(name) : refers to Variable name
Function(t, name, param*, s) : defines Function name Call(name, exp*) : refers to Function name
Same name!
![Page 75: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/75.jpg)
Scope
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1); }
int power(int x, int n) { if(x <= 0) return 1; else return x * power(x, n - 1);}
binding rules
Param(t, name) : defines Variable name Var(name) : refers to Variable name
Function(t, name, param*, s) : defines Function name Call(name, exp*) : refers to Function name
Wrong!
![Page 76: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/76.jpg)
Scope
int fib(int n) { if(n <= 1) return 1; else return fib(n - 2) + fib(n - 1); }
int power(int x, int n) { if(x <= 0) return 1; else return x * power(x, n - 1);}
binding rules
Param(t, name) : defines Variable name Var(name) : refers to Variable name
Function(t, name, param*, s) : defines Function name scopes Variable
Call(name, exp*) : refers to Function name
![Page 77: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/77.jpg)
Scope
int power(int x, int n) {
int power(int n) { if(n <= 0) return 1; else return power(n - 1) * x; }
return power(n);}
binding rules
Param(t, name) : defines Variable name Var(name) : refers to Variable name
Function(t, name, param*, s) : defines Function name scopes Variable, Function
Call(name, exp*) : refers to Function name
![Page 78: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/78.jpg)
Demo: Name Binding in the Spoofax Language Workbench
![Page 79: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/79.jpg)
Declarative Name Binding and Scope Rules
binding rules
Param(t, name) : defines Variable name Var(name) : refers to Variable name
Function(t, name, param*, s) : defines Function name scopes Variable, Function
Call(name, exp*) : refers to Function name
Incremental name resolution algorithm
Name checks
Semantic code completion
Reference resolution
![Page 80: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/80.jpg)
Semantics of Name Binding?
binding rules
Param(t, name) : defines Variable name Var(name) : refers to Variable name
Function(t, name, param*, s) : defines Function name scopes Variable, Function
Call(name, exp*) : refers to Function name
Research: how to characterize correctness of the result of name resolution without appealing to the algorithm itself?
Analogy: declarative semantics of syntax definition
![Page 81: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/81.jpg)
Language Designer’s Workbench
Language Design
SyntaxDefinition
NameBinding
TypeSystem
DynamicSemantics
Transforms
SDF3 Stratego
ConsistencyProof
TS DynSem
Tests
Name Bindingwith NaBL
ResponsiveEditor (IDE)
IncrementalCompiler
![Page 82: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/82.jpg)
Language Designer’s Workbench
Language Design
SyntaxDefinition
NameBinding
TypeSystem
DynamicSemantics
Transforms
SDF3 Stratego
ConsistencyProof
NaBL TS DynSem
TestsResponsiveEditor (IDE)
IncrementalCompiler
![Page 83: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/83.jpg)
ConsistencyProof Tests
Spoofax 2.0: Prototype the Language Designer’s Workbench
templates // statements
Statement.Return = <return <Exp>;> Statement.If = < if(<Exp>) <Statement> else <Statement> >
binding rules Param(t, name) : defines Variable name of type t Var(name) : refers to Variable name
type rules Call(name, exp*) : t where definition of name : (t*, t) and exp* : t_exp* and t_exp* == t*
rules
e --> True(), s1 --> v ---------------------- If(e, s1, s2) --> v e --> False(), s2 --> v ----------------------- If(e, s1, s2) --> v
rules
translate : Call(f, e*) -> [ <translate> e*, Callq(f), Movl(Reg("r"), Reg("t")) ]
capturing understanding of language definition
ResponsiveEditor (IDE)
IncrementalCompiler
![Page 84: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/84.jpg)
software
computer user
softwareengineer
language designer
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
_fib:! pushq %rbp! movq %rsp, %rbp! subq $16, %rsp! movl %edi, -4(%rbp)! movl -4(%rbp), %eax! cmpl $1, %eax! jg LBB1_2! movl $1, -12(%rbp)! jmp LBB1_3LBB1_2:! movl -4(%rbp), %eax! subl $2, %eax! movl %eax, %edi! callq _fib! movl %eax, %ecx! movl -4(%rbp), %edx! subl $1, %edx !! movl %ecx, -16(%rbp)! movl %edx, %edi! callq _fib! movl %eax, %ecx! movl -16(%rbp), %edx! addl %ecx, %edx! movl %edx, -12(%rbp)LBB1_3:! movl -12(%rbp), %eax! movl %eax, -8(%rbp)! movl -8(%rbp), %eax! addq $16, %rsp! popq %rbp! ret
programminglanguage
language engineer
meta-language
Spoofax, SDF3, StrategoNaBL, TS, DynSem
WebDSL, KeyBridge, Green-Marl, SugarJ
WebLab, researchr,YellowGrass, ...
![Page 85: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/85.jpg)
Education
![Page 86: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/86.jpg)
A computer science education should prepare its students to co-evolve with the changing language landscape, learn new technologies as they emerge,
contribute to their development, and apply them in new contexts
Software languages are the instruments that allow us to turn computational thinking into computation
That requires students to develop an understanding of the fundamentals of computing, rather than just
acquire a set of specific skills
![Page 87: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/87.jpg)
Concepts of Programming Languages - Study modern programming languages- Functional + OO (Scala)- Prototype based inheritance (JavaScript)- Connections with other disciplines
Modernizing Programming Education
Compiler Construction- Using language workbench- Complete compiler + IDE in one semester- Connection with research
Model-Driven Software Development - Language design project
Extending Curriculum- program analysis, formal semantics, verification, ...
![Page 88: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/88.jpg)
‘ICT in Education’
Improving efficiency and effectiveness of organization
EvaTool: automate the course evaluation workflow
WebLab: learning management system for programming education
researchr: bibliography management for literature surveys
![Page 89: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/89.jpg)
Automatic gradingwith unit testing
Instructor usessame environment
Program in browser Compile on server
Programming education in the browser
WebLab
![Page 90: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/90.jpg)
Thanks!
![Page 91: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/91.jpg)
Family
Connie VisserWim Visser
Jelle VisserBente Visser
Janine Mets
![Page 92: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/92.jpg)
Paul Klint (UvA)Andrew Tolmach (OGI)Doaitse Swierstra (UU)
Board TU Delft
EEMCS Faculty
AvL Committee
Employers
Arie van DeursenHenk Sips
Rob FastenauKarel Luyben
![Page 93: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/93.jpg)
Sander van der BurgEelco DolstraDanny Groenewegen Maartje de JongeZef Hemel
Lennart KatsRob VermaasSander VermolenGuido Wachsmuth
Stratego/XTNix
(1998-2006)
Luís AmorimElmer van ChasteletDanny GroenewegenGabriël Konat
Pierre NeronAugusto PassalaquaVlad Vergu Guido Wachsmuth
Richard VogelijOskar van RestChris GersenElmer van ChasteletNathan BruningRicky LindemanAndré Miguel Simões Dias VieiraTobi VollebregtVlad Vergu
Gabriël KonatSverre RabbelierNami NasserazadRuben VerhaafWouter MouwMichel WeststrateJippe HolwerdaNicolas PierronJonathan Joubert
Sander MakRoy van den BroekArmijn HemelJory van ZessenBogdan DumitriuRemko van BeusekomRene de GrootNiels JanssenArthur van Dam
Jozef KrugerJonne van WijngaardenAlan van DamRobert AniskoLennart SwartHedzer WestraArne de Bruijn
Anya BaggeMartin BravenboerEelco DolstraMerijn de Jonge
Karl KallebergKarina OlmosRob Vermaas
SpoofaxWebDSL
DisNixHydra
(2006-2013)
Language Designer’s
Workbench(2013-2018)
Mircea VodaDaco Harkes
Research Group
![Page 94: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/94.jpg)
Oracle Labs
Philips Research
SERC
Sponsors
Jacquard, Open Competition, VICI
![Page 95: Programming languages shape computational thinking](https://reader033.fdocuments.in/reader033/viewer/2022052822/554f85f2b4c905435d8b4bd9/html5/thumbnails/95.jpg)
The Future of ProgrammingJohn Hughes
Manuel SerranoMarkus PüschelMarkus Völter
Sebastian ErdwegStefan Hanenberg
Tiark Rompf
Arie van DeursenBrandon HillDaan LeijenErik Meijer
Guido WachsmuthHarry Buhrman
Herman Geuvers