Names - COP4020 Programming Languages Names, Scopes, and...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
COP4020 Programming Languages Names, Scopes, and Bindings Prof. Robert van Engelen
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP4020 Spring 2011 2 3/22/11 Overview ! Abstractions and names ! Binding time ! Object lifetime ! Object storage management " Static allocation " Stack allocation " Heap allocation ! Scope rules ! Static versus dynamic scoping ! Reference environments ! Overloading and polymorphism
Background image of page 2
COP4020 Spring 2011 3 3/22/11 Name = Abstraction ! Names enable programmers to refer to variables, constants, operations, and types ! Names are control abstractions and data abstractions for program fragments and data structures " Control abstraction: ! Subroutines (procedures and functions) allow programmers to focus on manageable subset of program text, subroutine interface hides implementation details ! Control flow constructs (if-then, while, for, return) hide low-level machine ops " Data abstraction: ! Object-oriented classes hide data representation details behind a set of operations " Abstraction in the context of high-level programming languages refers to the degree or level of working with code and data " Enhances the level of machine-independence " "Power" of constructs
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP4020 Spring 2011 4 3/22/11 Binding Time ! A binding is an association between a name and an entity ! Binding time is the time at which an implementation decision is made to create a name ! entity binding: " Language design time : the design of specific program constructs (syntax), primitive types, and meaning (semantics) " Language implementation time : fixation of implementation constants such as numeric precision, run-time memory sizes, max identifier name length, number and types of built-in exceptions, etc. " Program writing time : the programmer's choice of algorithms and data structures " Compile time : the time of translation of high-level constructs to machine code and choice of memory layout for data objects " Link time : the time at which multiple object codes (machine code files) and libraries are combined into one executable " Load time : when the operating system loads the executable in memory " Run time : when a program executes
Background image of page 4
COP4020 Spring 2011 5 3/22/11 Binding Time Examples ! Language design: " Syntax (names ! grammar) ! if (a>0) b:=a; (C syntax style) ! if a>0 then b:=a end if (Ada syntax style) " Keywords (names ! builtins) ! class (C++ and Java), endif or end if (Fortran, space insignificant) " Reserved words (names ! special constructs) ! main (C), writeln (Pascal) " Meaning of operators (operator ! operation) ! + (add), % (mod), ** (power) " Built-in primitive types (type name ! type) ! float, short, int, long, string ! Language implementation " Internal representation of types and literals (type ! byte encoding) ! 3.1 (IEEE 754) and "foo bar” (\0 terminated or embedded string length) " Storage allocation method for variables (static/stack/heap)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
COP4020 Spring 2011 6 3/22/11 Binding Time Examples (cont’d) ! Compile time " The specific type of a variable in a declaration (name !
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/01/2012 for the course COP 4020 taught by Professor Engelen during the Spring '11 term at FSU.

Page1 / 50

Names - COP4020 Programming Languages Names, Scopes, and...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online