Programming Language Design and Implementation-Pratt
Programming Language Design and Implementation-Pratt
Six primary reasons: o To improve your ability to develop effective algorithms o To improve your use of your existing programming language o To increase your vocabulary of useful programming constructs o To allow a better choice of programming language o To make it easier to learn a new language o To make it easier to design a new language
o o o o o
Creation of standards
o Language standards defined by national standards bodies: ISO International Standards organization IEEE Institute of Electrical and Electronics Engineers ANSI American National Standards Institute All work in a similar way: Working group of volunteers set up to define standard Agree on features for new standard Vote on standard If approved by working group, submitted to parent organization for approval.
Standards in the US are voluntary: There is no federal standards-making organization. NIST - National Institute for Standards and Technology develops standards
that are only required on federal agencies, not for commercial organizations. But: Consensus is the key to standards making: Contentious features often omitted to gain consensus Only vendors have a vested interest in the results Users dont care until standard approved, and then it is too late!
Classes of Binding Times (also refer complete theory from Page No. 8)
1. Execution time (run time) (dynamic binding) On entry to subprogram or block. o Binding of formal to actual parameters in C. At arbitrary points during execution o Binding of variables to values by assignments. (can be modified repeatedly during execution) 2. Translation time (compile time) Bindings chosen by the programmer o Variable names and types Bindings chosen by the translator o Relative locations of a data object in the storage allocated for a procedure Bindings chosen by the loader o Actual addresses 3. Language implementation time The details associated with the representation of numbers and of arithmetic operations. (integer type memory representation) 4. Language definition time Possible statement forms, data structure types, program structures. (integer type definition)
Storage-Management Phases
1. Initial allocation At start of execution, each piece of storage may either be allocated for some use or free. If free initially, it is available for allocation dynamically as execution proceeds. Any storage management system requires some technique for keeping track of free storage as well as mechanisms for allocation of free storage as the need arises during execution. 2. Recovery Storage that has been allocated and used, and that subsequently becomes available, must be recovered by the storage manager for reuse. Recovery may be very simple, as in the repositioning of a stack pointer, or very complex, as in garbage collection. 3. Compaction and reuse Storage recovered may be immediately ready for reuse or compaction may be necessary to construct large block of free storage from small pieces. Reuse of storage ordinarily involves tha same mechanisms as initial allocation.