Programming Languages: Design and Implementation

Terrence W. Pratt
Prentice Hall
20 years old, but still extremely usefull.

Should get the 4th edition: ISBN: 0-13-027678-2

Chapter 1: Study of languages (what makes a language 'good')

Clarity, simplicity, and unity of language concept.
Everything is a 'variable'
Clarity of program syntax
Different things should look different
Notation of simple actions should be short
Naturalness for the application
Ocean is meant to write OSs
Support for abstraction
Allow types, functions, and OO, but with controlled 'weight'
Ease of program verification
Keep syntax and semantics simple
Strong type checking
Ease of allocation management
Program environment
TODO: Linkers (to other languages), editors, debuggers
Allow clear distinction between portable and non portable code
Cost of use
Have both an interpreter and a compiler, compile fast or efficient
Ocean doesn't have to be 'scriptable', but it would be nice

Chapter 2: Language Processors (what is the Virtual Machine)

Basic memory model
Flat array of Bytes
Floating points
IEEE-754: can support NaN/Inf
Memory model
Stack, code-section (also const section), data-section, heap
'Early', but with support for simulated 'late' binding.

Chapter 3: Elementary Data Types

Bit, Byte, QuartWord, HalfWord, Word, DoubleWord, QuadWord, Pointer, ShortFloat, LongFloat
(packed-) Struct, Union, Array
Class, String (utf8), Integer, Float, Boolean, Relation
Co-Routines, closures, delegates
Our, Semaphores, Critical Sections
Catch, Throw
'Coercion' (automatic conversion)
We won't do any coercion
Is an assignemnt a 'function' or a 'procedure'?
Assignment returns assigned value
Initialization of predefined complex structures is a good thing.
Literals have no meaning: a type or class should indicate that it can handle it and should do its own conversion.
So, what about deciding which type should handle it when multiple functions could match...
Don't: just flag as ambigue and force user to decide.
Most functions work on implicit arrays: some arguments may repeat.
What about: subranges, enumerations, array indexing by subrange or enumeration
Can how a type is shown be bound to how it is stores/used?
What character set is used?
Ocean will use UTF-8, period.
Code is an elementary (const) datatype
Vars/Objects may have compile time 'restrictions' which can be changed/set/reset by certain functions

Chapter 4: Structured Data Types

Supported data structures
Data structures can be:
Variant records: free union (like C) or discriminated-union (like ada)
Is a string an elementary data type? RegExp? LValue?
To be decided
Stacks, Queues, Trees, Directed graph, Property Lists (or Hashes), Sets
To be decided
I/O lifetime > program
To be decided
What about fn's working on a whole array/whatever
Packed support?

Chapter 5: Subprograms and programmer defined Data Types

Subroutine activation record
Is a real data object?
When are types the same?

Chapter 6: X

Chapter 7: X

Chapter 8: Storage Management

Chapter 9: Syntax and Translation

Chapter 10: Operating and Programming Environments

Embedded (also Kernels)
Programming environments
Do not fall in the trap of older systems: current systems have ample resources
Help big projects by good version/revision management
Testing and debugging
trace a variable, assertions, pre and post conditions

Chapter 11: Theoretical Models

Syntax definition
A variation on BNF, actually one of the smaller problems
Efficient parsing
Very little context sensitivity in the syntaa, Should have a xxx parser
Semantics definition
Prose for now, should read on techniques: operational, functional/denotational, and/or axiomatic
Prove correctness or static analysis