Modern Programming Languages CS508 Virtual University of Pakistan
Total Page:16
File Type:pdf, Size:1020Kb
Modern Programming Languages (CS508) VU Modern Programming Languages CS508 Virtual University of Pakistan Leaders in Education Technology 1 © Copyright Virtual University of Pakistan Modern Programming Languages (CS508) VU TABLE of CONTENTS Course Objectives...........................................................................................................................4 Introduction and Historical Background (Lecture 1-8)..............................................................5 Language Evaluation Criterion.....................................................................................................6 Language Evaluation Criterion...................................................................................................15 An Introduction to SNOBOL (Lecture 9-12).............................................................................32 Ada Programming Language: An Introduction (Lecture 13-17).............................................45 LISP Programming Language: An Introduction (Lecture 18-21)...........................................63 PROLOG - Programming in Logic (Lecture 22-26) .................................................................77 Java Programming Language (Lecture 27-30)..........................................................................92 C# Programming Language (Lecture 31-34) ...........................................................................111 PHP – Personal Home Page PHP: Hypertext Preprocessor (Lecture 35-37)........................129 Modern Programming Languages-JavaScript ........................................................................141 Lecture 38....................................................................................................................................141 Location of Code.........................................................................................................................141 Arrays..........................................................................................................................................143 Operators ....................................................................................................................................144 Type Conversion.........................................................................................................................144 Control Statements.....................................................................................................................144 Labels and Flow Control ...........................................................................................................145 Modern Programming Languages-JavaScript ........................................................................147 Lecture 39....................................................................................................................................147 Objects.........................................................................................................................................147 Two Object Models ....................................................................................................................147 Modern Programming Languages............................................................................................160 Lecture # 40.................................................................................................................................160 Names ..........................................................................................................................................160 Special Words .............................................................................................................................160 Possible binding times ................................................................................................................160 Static and Dynamic Binding......................................................................................................161 Type Bindings .............................................................................................................................161 Dynamic Type Binding ..............................................................................................................161 Storage Bindings.........................................................................................................................161 Categories of variables by lifetimes ..........................................................................................161 Explicit Heap Dynamic Variables.............................................................................................162 Implicit Heap Dynamic Variables.............................................................................................162 Modern Programming Languages Lecture 41.........................................................................163 Type Checking ............................................................................................................................163 Strongly Typed Languages? ......................................................................................................163 Type Compatibility.....................................................................................................................163 Data Types...................................................................................................................................164 Primitive Data Types..................................................................................................................164 Character String Types..............................................................................................................164 Ordinal Types (user defined).....................................................................................................165 Four Categories of Arrays (based on subscript binding and binding to storage) ................167 Modern Programming Languages Lecture 42.........................................................................168 Records-(like structs in C/C++).................................................................................................168 Pointers........................................................................................................................................169 Unions..........................................................................................................................................170 Arithmetic Expressions..............................................................................................................172 Modern Programming Languages Lecture 43.........................................................................173 2 © Copyright Virtual University of Pakistan Modern Programming Languages (CS508) VU Modern Programming Languages Lecture 44.........................................................................177 1. FORTRAN 77 and 90.............................................................................................................181 2. ALGOL 60...............................................................................................................................182 3. Pascal .......................................................................................................................................182 4. Ada ...........................................................................................................................................183 5. C...............................................................................................................................................183 6. C++ ..........................................................................................................................................183 7. Java..........................................................................................................................................183 Logically-Controlled Loops .......................................................................................................184 Examples .....................................................................................................................................184 Unconditional Branching...........................................................................................................185 Conclusion...................................................................................................................................185 Modern Programming Languages Lecture 45.........................................................................187 Parameters and Parameter Passing..........................................................................................187 1. Pass-by-value (in mode) ........................................................................................................187 2. Pass-by-result (out mode) ......................................................................................................187 Implementing Parameter Passing.............................................................................................188 Design Considerations for Parameter Passing.........................................................................188 Concluding Remarks..................................................................................................................188 3 © Copyright Virtual University of Pakistan Modern Programming Languages (CS508) VU Course Objectives Thousands of