Course Summary, Exams of Programming Languages

Programming Languages — Summary. 2. Programming Language Selection and Design. • Choice of best programming language depends on: 1. Intended application.

Typology: Exams

2022/2023

Uploaded on 05/11/2023

country.side
country.side 🇺🇸

4.1

(15)

243 documents

1 / 22

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Programming Languages
Course Summary
Benjamin J. Keller
Department of Computer Science, Virginia Tech
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16

Partial preview of the text

Download Course Summary and more Exams Programming Languages in PDF only on Docsity!

Programming Languages

Course Summary

Benjamin J. Keller

Department of Computer Science, Virginia Tech

• Programming Language Selection and Design

  1. Intended computers to be used.2. Intended programmers.1. Intended application.Choice of best programming language depends on:

And many general principles!

Criteria for Language Design

Writeability

Readability — Modifiability and Maintenance

Reliability

Fast translation

Efficient object code

Machine independence

Simplicity

The language should be easy to master

Bad examples: PL/I and Ada — don’t throw in kitchen sink

and (if redundant) development of dialects.If too complex, danger of unexpected interactions, subsetting

Einstein“Everything should be as simple as possible, but not simpler”Can go too far: Basic, LISP syntax.Simple conceptual model of semantics.

Orthogonality and Generality

restrictions.Few basic features — free from interactions. No special

enumerated types cannot be read or written, etc.simple type, constants only defined for built-in basic types,Example: Problems with Pascal: Function can only return

Algol 68 carries to extremes, everything has value.

well.Smalltalk, Eiffel, other pure object-oriented languages do it

Clear Syntactic and Semantic Description

well-written manual.Formal grammar, formal semantics helpful but also need

Original presentation usually too vague. Refined.

ALGOL 68 problem with redefining terms.

Reliability

discovered.Syntactic and logical (semantic) errors discouraged and easily

Related to writeability, readability, and modifiability.

Static checks

Separate (but not independent) compilation

Minor modifications should not require major changes.

Problems: Ada out params, Pascal variant records, side-effects.Clear semantics supporting verification.

Simplicity of compiler implementation.

Other Qualities

Fast translation can only be an asset.also simple to parse for the human programmer, and that A language that is simple to parse for the compiler is

(^) — Wirth

Efficient Object Code — So people will use program

Machine independence — hard to achieve completely.

Principles from MacLennan

(^) Abstraction

: Avoid requiring something to be stated more than

once; factor out the recurring pattern.

(^) Automation

: Automate mechanical, tedious, or error-prone

activities. (Provide higher level features, e.g. DO loop)

(^) Defense in Depth

: If an error gets through one line of defense,

DO, varieties of GOTO in FORTRAN)incorrect but syntactically ok, then should fail type-checking:then it should be caught by the next line of defense. (e.g. if

(^) Information Hiding

: Modules should be designed so that: (1)

nothing more.information needed to implement the module correctly, andcorrectly, and nothing more. (2) The implementor has all theThe user has all the information needed to use the module

(^) Labeling

: We should not require the user to know the absolute

labelled case as opposed to unlabelled)with any position that must be referenced elsewhere. (E.g.,position of an item in a list. Instead, we should associate labels

(^) Localized Cost

: A user should only pay for what he uses; avoid

parameters)simple things are expensive, e.g ALGOL DO, defaultdistributed costs. (Don’t build in so much generality that

(^) Manifest Interface

: All interfaces must be apparent (manifest)

in the syntax. (Clear how to use, no side-effects)

(^) Orthogonality

: Independent functions should be controlled by

control).independent mechanisms. (Avoid dependencies, e.g. logic and

(^) Portability

: Avoid features or facilities that are dependent on a

particular machine or a small class of machines.

(^) Syntactic Consistency

: Things which look similar should be

similar and things which look different should be different.

(^) Zero-One-Infinity

: The only reasonable numbers in

(Avoid special cases, E.g. compound commands in Pascal.)programming language design are zero, one, and infinity.

Why This Course?

jobs course!).FORTRAN, PL/I, LISP, APL, SNOBOL, etc. (languages forOriginally survey of programming languages: COBOL,

languages.Get better understanding of principle features of programming

Explore design space of programming languages.

reflected by different programming language paradigms.Introduce different ways of thinking about programming

  1. Issues in type-checking: Static vs. dynamic type-checking. type systems (e.g. variant records). Problems with pointers.Type compatibility (structural vs. name equivalence). Holes in
  2. Abstract data types and representation in programming languages.
  3. Expressions: Order of evaluation (including short-circuit evaluation), functions, and side-effects
  4. Programming in the large: Support from languages8. Polymorphism — implicit and explicit.7. Control structures (including exception handling). environments.) Top-down vs. object-based design.independent compilation, explicit importing and exporting of(information hiding, encapsulation, separate but not
  1. Programming language paradigms: (a) Imperative: Assignment statements (including order of Iterators. Procedures, coroutines.evaluation, side-effects, and aliasing) and control structures.

(b) Functional: Expanded expression constructs. Pattern verification. ML as an example.implementation on highly-parallel computers). ProgramImplementation issues (efficiency and possibility ofvs. eager languages. Recursively defined types.matching and type inference. Higher-order functions. Lazy

(c) Logic: Basis in mathematical logic — extract program from

Use of cut. Closed-world assumption and negation.and control (sort of). Importance of ordering of clauses.Relation to resolution theorem proving. Separation of logiccomputations). Computation as backtracking + unification.proof. Relational programming (and reversability of