software languages

78
IN4303 2014/15 Compiler Construction Software Languages language - languages - software Guido Wachsmuth

Upload: guido-wachsmuth

Post on 10-May-2015

4.944 views

Category:

Education


0 download

DESCRIPTION

This introduction lecture sets the scene for the course IN4303 on Compiler Construction at Delft University of Technology. We introduce the notions of software languages and language software from a bigger, interdisciplinary picture. We start with a linguistic discussion of language, its properties, and the study of language in philosophy and linguistics. We then investigate natural languages, controlled languages, and artificial languages to emphasise the human ability to control and construct languages. At the end of the first part of the lecture, we arrive at the notion of software languages as means to communicate software between people. In the second part of the lecture, we extend the notion of software languages as means to realise processes on machines. We give an overview of language software, starting from interpreters and compilers. We then introduce various language processors as basic building blocks of compilers. We continue with a comparison of traditional compilers and modern compilers in IDEs. Finally, we introduce traditional compiler compilers and modern language workbenches as tools to construct compilers.

TRANSCRIPT

Page 1: Software Languages

IN4303 2014/15 Compiler Construction

Software Languages language - languages - software

Guido Wachsmuth

Page 2: Software Languages

Software Languages 2

Page 3: Software Languages

Software Languages 3

language

definition

properties

study

languages

natural

controlled

artificial

software

language software

language processors

compilers

compiler construction

Page 4: Software Languages

Software Languages 4

language definition

Page 5: Software Languages

Software Languages 5

Language is the source of misunderstandings.

Antoine de Saint-Exupéry: Le Petit Prince.

Page 6: Software Languages

Software Languages 6

Language is

a purely human and non-instinctive method

of communicating ideas, emotions, and desires

by means

of a system of voluntarily produced symbols.

Edward Sapir: Language. An Introduction to the Study of Speech.

Page 7: Software Languages

Software Languages 7

Language is

a method

of communicating

by means

of symbols.

Edward Sapir: Language. An Introduction to the Study of Speech.

Page 8: Software Languages

Software Languages 8

Language is

a purely human and non-instinctive method

of communicating

by means

of a system of voluntarily produced symbols.

Edward Sapir: Language. An Introduction to the Study of Speech.

Page 9: Software Languages

Software Languages 9

Language is

a purely human and non-instinctive method

of communicating ideas, emotions, and desires

by means

of a system of voluntarily produced symbols.

Edward Sapir: Language. An Introduction to the Study of Speech.

Page 10: Software Languages

Software Languages 10

language properties

Page 11: Software Languages

Software Languages 11

non-instinctive

Page 12: Software Languages

Software Languages 12

symbolic

Page 13: Software Languages

Software Languages 13

arbitrary

Page 14: Software Languages

Software Languages 14

systematic

Page 15: Software Languages

Software Languages 15

productive

Page 16: Software Languages

Software Languages 16

conventional

Page 17: Software Languages

Software Languages 17

modifiable

Page 18: Software Languages

Software Languages 18

language study

Page 19: Software Languages

Software Languages 19

meta language facility

Page 20: Software Languages

Software Languages 20

Philosophy

Linguistics

lexicology

grammar

morphology

syntax

phonology

semantics

Interdisciplinary

applied linguistics

computational linguistics

historical linguistics

neurolinguistics

psycholinguistics

sociolinguistics

Page 21: Software Languages

Software Languages 21

natural languages

Page 22: Software Languages

Software Languages 22

7106 known living languages - 6.3 billion speakers

Ethnologue - Languages of the World.

Page 23: Software Languages

Software Languages 23

A language is a dialect with a navy and an army.

Max Weinreich: YVO Bletter 25(1).

Page 24: Software Languages

Software Languages 24

controlled languages

Page 25: Software Languages

Software Languages 25

meta language facility

Page 26: Software Languages

Software Languages 26

Classical Sanskrit

Page 27: Software Languages

Software Languages 27

German

Page 28: Software Languages

Software Languages 28

ASD Simplified

Technical English

Page 29: Software Languages

Software Languages 29

artificial languages

Page 30: Software Languages

Software Languages 30

Page 31: Software Languages

Software Languages 31

Page 32: Software Languages

Software Languages 32

Klingon

Page 33: Software Languages

Software Languages 33

Na'vi

Page 34: Software Languages

Software Languages 34

software languages

Page 35: Software Languages

Software Languages 35

8512 programming languages - 18.5 million developers

Diarmuid Pigott: History of Programming Languages. IDC: 2014 Worldwide Software Developer and ICT-Skilled Worker Estimates.

Page 36: Software Languages

Software Languages 36

languages to engineer software

Page 37: Software Languages

Software Languages 37

to provide a means

of communicating

numerical methods and other procedures

between people

John W. Backus: The Syntax and Semantics of the Proposed International Algebraic Language

of Zürich ACM-GAMM Conference.

Page 38: Software Languages

Software Languages 38

to provide a means

of communicating

numerical methods and other procedures

between people

John W. Backus: The Syntax and Semantics of the Proposed International Algebraic Language

of Zürich ACM-GAMM Conference.

Page 39: Software Languages

Software Languages 39

software language

natural language

Page 40: Software Languages

Software Languages 40

Philosophy

Linguistics

lexicology

grammar

morphology

syntax

phonology

semantics

Interdisciplinary

Computer Science

syntax

semantics

Page 41: Software Languages

Software Languages 41

/* factorial function */!let ! var x := 0! function fact(n : int) : int = if n < 1 then 1 else (n * fact(n - 1))!in ! for i := 1 to 3 do ( x := x + fact(i); printint(x); print(" ") )!end

Tiger the lecture language

Page 42: Software Languages

Software Languages 42

#include <stio.h>!/* factorial function */!int fac(int num) { if (num < 1) return 1; else return num * fac(num - 1);}!int main() { printf(“%d! = %d\n”, 10, fac(10)); return 0;}

C another lecture language

Page 43: Software Languages

Software Languages 43

class Main {! public static void main(String[] args) { System.out.println(new Fac().fac(10)); }}!class Fac {! public int fac(int num) { int num_aux; if (num < 1) num_aux = 1; else num_aux = num * this.fac(num - 1); return num_aux; }}

MiniJava the lab language

Page 44: Software Languages

Software Languages 44

language software

Page 45: Software Languages

Software Languages 45

languages to engineer software

Page 46: Software Languages

Software Languages 46

pieces of software themselves

Page 47: Software Languages

Software Languages 47

to provide a means

for realising a stated process

on a variety of machines

John W. Backus: The Syntax and Semantics of the Proposed International Algebraic Language

of Zürich ACM-GAMM Conference.

Page 48: Software Languages

Software Languages 48

to provide a means

for realising a stated process

on a variety of machines

John W. Backus: The Syntax and Semantics of the Proposed International Algebraic Language

of Zürich ACM-GAMM Conference.

Page 49: Software Languages

Software Languages 49

interpretersoftware language

compilersoftware language

machine language

Page 50: Software Languages

Software Languages

natural language

natural languagetranslator

50

compilersoftware language

machine language

Page 51: Software Languages

Software Languages 51

language software language processors

Page 52: Software Languages

Software Languages 52

language processors scanners & parsers

3 * +7 213 * +7 21

3 * +7 21

Exp ExpExp

Exp

Exp

scanner parser

Page 53: Software Languages

Software Languages 53

language processors scannerless parsers

3 * +7 21

3 * +7 21

Exp ExpExp

Exp

Exp

parser

Page 54: Software Languages

Software Languages 54

language processors pretty-printers

3 * +7 21

3 * +7 21

Exp ExpExp

Exp

Exp

pretty- printer

Page 55: Software Languages

Software Languages 55

language processors type checkers

3 * +7 21

Exp ExpExp

Exp

Exp

type checker

errors

Page 56: Software Languages

Software Languages 56

language processors optimisers

3 * +7 21

Exp ExpExp

Exp

Exp

optimiser 42

Exp

Page 57: Software Languages

Software Languages 57

language processors generators

ldc 3 ldc 7 imul ldc 21 iadd

3 * +7 21

Exp ExpExp

Exp

Exp

generator

Page 58: Software Languages

Software Languages 58

language software compilers

Page 59: Software Languages

Software Languages 59

> ls

Course.java

> javac -verbose Course.java

[parsing started Course.java] [parsing completed 8ms] [loading java/lang/Object.class(java/lang:Object.class)] [checking university.Course] [wrote Course.class] [total 411ms]

> ls

Course.class Course.java

traditional compilers example

Page 60: Software Languages

Software Languages 60

traditional compilers architecture

source code

errors

parse generate

check

machine code

Page 61: Software Languages

Software Languages 61

traditional compilers compilation by transformation

backend

frontend

parse desugar analyse normalise

generate optimise format

Page 62: Software Languages

Software Languages 62

modern compilers in IDEs features

Page 63: Software Languages

Software Languages 63

modern compilers in IDEs features

Page 64: Software Languages

Software Languages 64

modern compilers in IDEs features

Page 65: Software Languages

Software Languages 65

modern compilers in IDEs architecture

source code

parse generate

machine code

check

Page 66: Software Languages

Software Languages 66

language software compiler construction

Page 67: Software Languages

Software Languages 67

meta language facility

Page 68: Software Languages

Software Languages 68

traditional compiler compilers manual implementation

language implementation

compile

compiler

Page 69: Software Languages

Software Languages 69

traditional compiler compilers compilation + compilation

language implementation

compile

compilerlanguage definition

compile

Page 70: Software Languages

Software Languages 70

traditional compiler compilers example

syntax definition

errors

parse generate

check

parser code

Page 71: Software Languages

Software Languages 71

traditional compiler compilers compilation + interpretation

interpreterlanguage definition

compile

language implementation

Page 72: Software Languages

Software Languages 72

traditional compiler compilers example

syntax definition

errors

parse generate

check

parse table

generic parser

Page 73: Software Languages

Software Languages 73

language workbenches architecture

language definition

parse generate

language implementation

check

Page 74: Software Languages

Software Languages 74

Spoofax language workbench

Page 75: Software Languages

Software Languages

Stratego

NaBL TS

SDF3

ESV editor

SPT tests

75

syntax definition

concrete syntax

abstract syntax

static semantics

name binding

type system

dynamic semantics

translation

interpretation

Page 76: Software Languages

Software Languages 76

Except where otherwise noted, this work is licensed under

Page 77: Software Languages

Software Languages 77

attribution

slide title author license

1, 35 Programming language textbooks K.lee public domain

2 The Bigger Picture F. Delventhal CC BY 2.0

5 Rose 2 des Kleinen Prinzen Antoine Saint-Exupéry public domain

11 Dog and owner on Ballykinler Beach Jonny Green CC BY 2.0

12 Fashionable melange of English words (1) trialsanderrors public domain

13 Gift asenat29 CC BY 2.0

13 Toxic John Morgan CC BY 2.0

14 Latin Grammar Anthony Nelzin

15 Ginkgo Biloba Johann Wolfgang von Goethe public domain

16 Sub-deb slang genibee CC BY-NC 2.0

17 Wednesday Michael Fawcett CC BY-NC-SA 2.0

19, 25, 67 Thesaurus Enoch Lau CC BY-SA 3.0

22The captured Swiftsure, Seven Oaks, Loyal George and Convertine brought through Goeree Gat

Willem van de Velde the Younger public domain

Page 78: Software Languages

Software Languages 78

attribution

slide title author license

23 Tower of Babel Pieter Bruegel the Elder public domain

26 The Ashtadhyayi translated by Srisa Chandra Vasu public domain

27 Buchdruckerduden public domain

28Boeing 737-300 -400 -500 Manitenance

Manual Alaska AirlinesBill Abbott CC BY-SA 2.0

30 Esperanto public domain

31 Quenya Juanma Pérez Rabasco CC BY 2.0

32 Klingon Dictionary Josh Bancroft CC BY-NC 2.0

33 Overweight Na'vi HARRY NGUYEN CC BY 2.0

36, 45, 46 IBM Electronic Data Processing Machine NASA public domain

41 Tiger Bernard Landgraf CC BY-SA 3.0

42 The C Programming Language Bill Bradford CC BY 2.0

43 Italian Java book cover

49-73 PICOL icons Melih Bilgil CC BY 3.0