1 Introduction  Programming linguistics:

advertisement
1
Introduction
 Programming linguistics:
• concepts and paradigms
• syntax, semantics, and pragmatics
• language processors.
 Historical development of programming languages and
paradigms.
© 2004, D.A. Watt, University of Glasgow
1-1
Programming linguistics
 Programming linguistics is the study of programming
languages (PLs).
 This is by analogy with linguistics, the study of natural
languages (NLs):
• Both PLs and NLs have syntax (form) and semantics (meaning).
 However, NLs are far broader, more expressive, and more
subtle than PLs.
 Also, linguists are limited to studying existing NLs.
Computing scientists can design, specify, and implement
new PLs.
1-2
Properties
 A PL must be universal – capable of expressing any
computation.
• A language without iteration or recursion is not universal.
• A language of recursive functions (and nothing else) is universal.
 A PL should be reasonably natural for expressing
computations in its intended application area.
 A PL must be implementable – it must be possible to run
every program on a computer.
 A PL should be capable of acceptably efficient
implementation.
1-3
Concepts
 Concepts are building blocks of programs and PLs:
• values and types
• variables and storage
• bindings and scope
• procedural abstraction
• data abstraction
• generic abstraction (not covered in this course)
• concurrency (not covered in this course).
1-4
Paradigms
 A paradigm is a style of programming, characterized by a
particular selection of key concepts.
 Imperative programming: variables, commands,
procedures.
 Object-oriented (OO) programming: objects, methods,
classes.
 Concurrent programming: processes, communication.
 Functional programming: values, expressions, functions.
 Logic programming: assertions, relations.
1-5
Syntax, semantics, and pragmatics
 A PL’s syntax is concerned with the form of programs:
how expressions, commands, declarations, and other
constructs must be arranged to make a well-formed
program.
 A PL’s semantics is concerned with the meaning of (wellformed) programs: how a program may be expected to
behave when executed on a computer.
 A PL’s pragmatics is concerned with the way in which the
PL is intended to be used in practice. Pragmatics include
the paradigm(s) supported by the PL.
1-6
Language processors
 A language processor is a system for processing programs
– either executing them or preparing them for execution.
 Language processors include:
• compilers
• interpreters
• source-code editors
• symbolic debuggers.
1-7
Historical development (1)
1955
Fortran
Lisp
Algol60
1960
Cobol
1965
PL/I
Algol68
Simula
1970
Pascal
Smalltalk
C
1975
Modula
ML
1980
Ada83
OO
C++
imperative
concurrent
functional
1985
1-8
Historical development (2)
1980
Ada83
1985
C++
Haskell
1995
Ada95
Java
2000
C#
OO
1990
imperative
concurrent
functional
2005
1-9
Download