This site uses cookies to deliver our services and to show you relevant ads and presentations. By clicking on "Accept", you acknowledge that you have read and understand our Cookie Policy , Privacy Policy , and our Terms of Use.
X

Download Programming Languages PowerPoint Presentation


Login   OR  Register
X


Iframe embed code :



Presentation url :

X

Description :

View and free download Programming Languages powerpoint presentation which is uploaded by honey an active user in belonging ppt presentation Education & Training category.

Tags :

Programming Languages

Home / Education & Training / Education & Training Presentations / Programming Languages PowerPoint Presentation

Programming Languages PowerPoint Presentation

Ppt Presentation Embed Code   Zoom Ppt Presentation

About This Presentation


Description : View and free download Programming Languages powerpoint presentation which is uploaded by honey an a... Read More

Tags : Programming Languages

Published on : Feb 10, 2014
Views : 663 | Downloads : 0


Download Now

Share on Social Media

             

PowerPoint is the world's most popular presentation software which can let you create professional Programming Languages powerpoint presentation easily and in no time. This helps you give your presentation on Programming Languages in a conference, a school lecture, a business proposal, in a webinar and business and professional representations.

The uploader spent his/her valuable time to create this Programming Languages powerpoint presentation slides, to share his/her useful content with the world. This ppt presentation uploaded by slidesfinder in this Education & Training category is available for free download,and can be used according to your industries like finance, marketing, education, health and many more.

SlidesFinder.com provides a platform to marketers, presenters and educationists along with being the preferred search engine for professional PowerPoint presentations on the Internet to upload their Programming Languages ppt presentation slides to help them BUILD THEIR CROWD!!

User Presentation
Related Presentation
Free PowerPoint Templates
Slide 1 - Programming Languages2nd editionTucker and Noonan Chapter 4 Names The first step toward wisdom is calling things by their right names. Anon. Chinese Proverb
Slide 2 - 4.1 Syntactic Issues 4.2 Variables 4.3 Scope 4.4 Symbol Table 4.5 Resolving References 4.6 Dynamic Scoping 4.7 Visibility 4.8 Overloading 4.9 Lifetime
Slide 3 - Recall that the term binding is an association between an entity (such as a variable) and a property (such as its value). A binding is static if the association occurs before run-time. A binding is dynamic if the association occurs at run-time. Name bindings play a fundamental role. The lifetime of a variable name refers to the time interval during which memory is allocated.
Slide 4 - Syntactic Issues Lexical rules for names. Collection of reserved words or keywords. Case sensitivity C-like: yes Early languages: no PHP: partly yes, partly no
Slide 5 - Reserved Words Cannot be used as Identifiers Usually identify major constructs: if while switch Predefined identifiers: e.g., library routines
Slide 6 - Variables Basic bindings Name Address Type Value Lifetime
Slide 7 - L-value - use of a variable name to denote its address. Ex: x = … R-value - use of a variable name to denote its value. Ex: … = … x … Some languages support/require explicit dereferencing. Ex: x := !y + 1
Slide 8 - // Pointer example: int x,y; int *p; x = *p; *p = y;
Slide 9 - Scope The scope of a name is the collection of statements which can access the name binding. In static scoping, a name is bound to a collection of statements according to its position in the source program. Most modern languages use static (or lexical) scoping.
Slide 10 - Two different scopes are either nested or disjoint. In disjoint scopes, same name can be bound to different entities without interference. What constitutes a scope?
Slide 11 - Algol C Java Ada Package n/a n/a yes yes Class n/a n/a nested yes Function nested yes yes nested Block nested nested nested nested For Loop no no yes automatic
Slide 12 - The scope in which a name is defined or delared is called its defining scope. A reference to a name is nonlocal if it occurs in a nested scope of the defining scope; otherwise, it is local.
Slide 13 - 1 void sort (float a[ ], int size) { 2 int i, j; 3 for (i = 0; i < size; i++) // i, size local 4 for (j = i + 1; j < size; j++) 5 if (a[j] < a[i]) { // a, i, j local 6 float t; 7 t = a[i]; // t local; a, i nonlocal 8 a[i] = a[j]; 9 a[j] = t; 10 } 11 }
Slide 14 - for (int i = 0; i < 10; i++) { System.out.println(i); ... } ... i ... // invalid reference to i
Slide 15 - Symbol Table A symbol table is a data structure kept by a translator that allows it to keep track of each declared name and its binding. Assume for now that each name is unique within its local scope. The data structure can be any implementation of a dictionary, where the name is the key.
Slide 16 - Each time a scope is entered, push a new dictionary onto the stack. Each time a scope is exited, pop a dictionary off the top of the stack. For each name declared, generate an appropriate binding and enter the name-binding pair into the dictionary on the top of the stack. Given a name reference, search the dictionary on top of the stack: If found, return the binding. Otherwise, repeat the process on the next dictionary down in the stack. If the name is not found in any dictionary, report an error.
Slide 17 - C program in Fig. 4.1, stack of dictionaries at line 7: At line 4 and 11:
Slide 18 - Resolving References For static scoping, the referencing environment for a name is its defining scope and all nested subscopes. The referencing environment defines the set of statements which can validly reference a name.
Slide 19 - 1 int h, i; 2 void B(int w) { 3 int j, k; 4 i = 2*w; 5 w = w+1; 6 ... 7 } 8 void A (int x, int y) { 9 float i, j; 10 B(h); 11 i = 3; 12 ... 13 } 14 void main() { 15 int a, b; 16 h = 5; a = 3; b = 2; 17 A(a, b); 18 B(h); 19 ... 20 }
Slide 20 - Outer scope: Function B: Function A: Function main:
Slide 21 - Symbol Table Stack for Function B: Symbol Table Stack for Function A: Symbol Table Stack for Function main:
Slide 22 - Line Reference Declaration 4 i 1 10 h 1 11 i 9 16 h 1 18 h 1
Slide 23 - Dynamic Scoping In dynamic scoping, a name is bound to its most recent declaration based on the program’s call history. Used be early Lisp, APL, Snobol, Perl. Symbol table for each scope built at compile time, but managed at run time. Scope pushed/popped on stack when entered/exited.
Slide 24 - 1 int h, i; 2 void B(int w) { 3 int j, k; 4 i = 2*w; 5 w = w+1; 6 ... 7 } 8 void A (int x, int y) { 9 float i, j; 10 B(h); 11 i = 3; 12 ... 13 } 14 void main() { 15 int a, b; 16 h = 5; a = 3; b = 2; 17 A(a, b); 18 B(h); 19 ... 20 }
Slide 25 - Using Figure 4.2 as an example: call history main (17)  A (10)  B Function Dictionary B A main Reference to i (4) resolves to in A.
Slide 26 - 1 int h, i; 2 void B(int w) { 3 int j, k; 4 i = 2*w; 5 w = w+1; 6 ... 7 } 8 void A (int x, int y) { 9 float i, j; 10 B(h); 11 i = 3; 12 ... 13 } 14 void main() { 15 int a, b; 16 h = 5; a = 3; b = 2; 17 A(a, b); 18 B(h); 19 ... 20 }
Slide 27 - Using Figure 4.2 as an example: call history main (17)  B Function Dictionary B main Reference to i (4) resolves to in global scope.
Slide 28 - Visibility A name is visible if its referencing environment includes the reference and the name is not reclared in an inner scope. A name redeclared in an inner scope effectively hides the outer declaration. Some languages provide a mechanism for referencing a hidden name; e.g.: this.x in C++/Java.
Slide 29 - 1 public class Student { 2 private String name; 3 public Student (String name, ...) { 4 this.name = name; 5 ... 6 } 7 }
Slide 30 - procedure Main is x : Integer; procedure p1 is x : Float; procedure p2 is begin ... x ... end p2; begin ... x ... end p1; procedure p3 is begin ... x ... end p3; begin ... x ... end Main; -- Ada -- x in p2? -- x in p1? Main.x? -- x in p3? p1.x? -- x in Main?
Slide 31 - Overloading Overloading uses the number or type of parameters to distinguish among identical function names or operators. Examples: +, -, *, / can be float or int + can be float or int addition or string concatenation in Java System.out.print(x) in Java
Slide 32 - Modula: library functions Read( ) for characters ReadReal( ) for floating point ReadInt( ) for integers ReadString( ) for strings
Slide 33 - public class PrintStream extends FilterOutputStream { ... public void print(boolean b); public void print(char c); public void print(int i); public void print(long l); public void print(float f); public void print(double d); public void print(char[ ] s); public void print(String s); public void print(Object obj); }
Slide 34 - Lifetime The lifetime of a variable is the time interval during which the variable has been allocated a block of memory. Earliest languages used static allocation. Algol introduced the notion that memory should be allocated/deallocated at scope entry/exit. Remainder of section considers mechanisms which break scope equals lifetime rule.
Slide 35 - C: Global compilation scope: static Explicitly declaring a variable static Remark: Java also allows a variable to be declared static