Modern Programming Languages CS508 Virtual University of Pakistan

Total Page:16

File Type:pdf, Size:1020Kb

Modern Programming Languages CS508 Virtual University of Pakistan 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
Recommended publications
  • Management of Large Sets of Image Data Capture, Databases, Image Processing, Storage, Visualization Karol Kozak
    Management of large sets of image data Capture, Databases, Image Processing, Storage, Visualization Karol Kozak Download free books at Karol Kozak Management of large sets of image data Capture, Databases, Image Processing, Storage, Visualization Download free eBooks at bookboon.com 2 Management of large sets of image data: Capture, Databases, Image Processing, Storage, Visualization 1st edition © 2014 Karol Kozak & bookboon.com ISBN 978-87-403-0726-9 Download free eBooks at bookboon.com 3 Management of large sets of image data Contents Contents 1 Digital image 6 2 History of digital imaging 10 3 Amount of produced images – is it danger? 18 4 Digital image and privacy 20 5 Digital cameras 27 5.1 Methods of image capture 31 6 Image formats 33 7 Image Metadata – data about data 39 8 Interactive visualization (IV) 44 9 Basic of image processing 49 Download free eBooks at bookboon.com 4 Click on the ad to read more Management of large sets of image data Contents 10 Image Processing software 62 11 Image management and image databases 79 12 Operating system (os) and images 97 13 Graphics processing unit (GPU) 100 14 Storage and archive 101 15 Images in different disciplines 109 15.1 Microscopy 109 360° 15.2 Medical imaging 114 15.3 Astronomical images 117 15.4 Industrial imaging 360° 118 thinking. 16 Selection of best digital images 120 References: thinking. 124 360° thinking . 360° thinking. Discover the truth at www.deloitte.ca/careers Discover the truth at www.deloitte.ca/careers © Deloitte & Touche LLP and affiliated entities. Discover the truth at www.deloitte.ca/careers © Deloitte & Touche LLP and affiliated entities.
    [Show full text]
  • Program #6: Word Count
    CSc 227 — Program Design and Development Spring 2014 (McCann) http://www.cs.arizona.edu/classes/cs227/spring14/ Program #6: Word Count Due Date: March 11 th, 2014, at 9:00 p.m. MST Overview: The UNIX operating system (and its variants, of which Linux is one) includes quite a few useful utility programs. One of those is wc, which is short for Word Count. The purpose of wc is to give users an easy way to determine the size of a text file in terms of the number of lines, words, and bytes it contains. (It can do a bit more, but that’s all of the functionality that we are concerned with for this assignment.) Counting lines is done by looking for “end of line” characters (\n (ASCII 10) for UNIX text files, or the pair \r\n (ASCII 13 and 10) for Windows/DOS text files). Counting words is also straight–forward: Any sequence of characters not interrupted by “whitespace” (spaces, tabs, end–of–line characters) is a word. Of course, whitespace characters are characters, and need to be counted as such. A problem with wc is that it generates a very minimal output format. Here’s an example of what wc produces on a Linux system when asked to count the content of a pair of files; we can do better! $ wc prog6a.dat prog6b.dat 2 6 38 prog6a.dat 32 321 1883 prog6b.dat 34 327 1921 total Assignment: Write a Java program (completely documented according to the class documentation guidelines, of course) that counts lines, words, and bytes (characters) of text files.
    [Show full text]
  • ENV-11 License Amendment
    CITY OF BURLINGTON ● DEPARTMENT OF PUBLIC WORKS ENV AMENDMENT TO SOLID WASTE LICENSE TO BE COMPLETED WHEN A VEHICLE FLEET CHANGES OR EARLY PICK UPS ARE REQUESTED PURSUANT TO CHAPTER 14, CODE OF ORDINANCES. (SEE INSTRUCTIONS ON BACK BEFORE COMPLETING) 11 IDENTIFICATION FEDERAL EIN ACCOUNT ID TRADE NAME (DBA, etc.) LEGAL NAME BUSINESS TELEPHONE NUMBER BUSINESS FAX NUMBER TAXPAYER REPRESENTATIVE YEARS IN BUSINESS FORM OF BUSINESS (check one) Sole Proprietorship Partnership/LLC Corporation BUSINESS ADDRESS CITY/TOWN STATE ZIP CODE CONTACT NAME CONTACT PHONE NUMBER CONTACT EMAIL ADDRESS AMENDMENT This is to amend the solid waste collection license for fiscal year 20____. EARLY PICK UPS Are you requesting early pick up? YES NO Are you requesting changes to an approved early pick up? YES NO Did you attach ENV-10B, Early Pick Up Requests? YES N/A CHANGES TO VEHICLE FLEET Has a vehicle been added to or removed from your fleet? YES NO Has the location of your parked vehicles changed? YES NO New Location: Did you attach ENV-10A, Vehicle Descriptions? YES N/A I certify that I have read the City of Burlington’s solid waste ordinance (Chapter 14, Burlington Code of Ordinances) and regulations. I understand that failure to observe the law and regulations could result in a revocation of my license to collect solid waste and recyclable material within the City of Burlington. I also certify that I understand the City of Burlington has a Noise Control Ordinance (Sec. 21-13, Code of Ordinances) and that I cannot begin the collection of solid waste or recyclable material before 7:00 a.m.
    [Show full text]
  • Cobol/Cobol Database Interface.Htm Copyright © Tutorialspoint.Com
    CCOOBBOOLL -- DDAATTAABBAASSEE IINNTTEERRFFAACCEE http://www.tutorialspoint.com/cobol/cobol_database_interface.htm Copyright © tutorialspoint.com As of now, we have learnt the use of files in COBOL. Now, we will discuss how a COBOL program interacts with DB2. It involves the following terms: Embedded SQL DB2 Application Programming Host Variables SQLCA SQL Queries Cursors Embedded SQL Embedded SQL statements are used in COBOL programs to perform standard SQL operations. Embedded SQL statements are preprocessed by SQL processor before the application program is compiled. COBOL is known as the Host Language. COBOL-DB2 applications are those applications that include both COBOL and DB2. Embedded SQL statements work like normal SQL statements with some minor changes. For example, that output of a query is directed to a predefined set of variables which are referred as Host Variables. An additional INTO clause is placed in the SELECT statement. DB2 Application Programming Following are rules to be followed while coding a COBOL-DB2 program: All the SQL statements must be delimited between EXEC SQL and END-EXEC. SQL statements must be coded in Area B. All the tables that are used in a program must be declared in the Working-Storage Section. This is done by using the INCLUDE statement. All SQL statements other than INCLUDE and DECLARE TABLE must appear in the Procedure Division. Host Variables Host variables are used for receiving data from a table or inserting data in a table. Host variables must be declared for all values that are to be passed between the program and the DB2. They are declared in the Working-Storage Section.
    [Show full text]
  • SETL for Internet Data Processing
    SETL for Internet Data Processing by David Bacon A dissertation submitted in partial fulfillment of the requirements for the degree of Doctor of Philosophy Computer Science New York University January, 2000 Jacob T. Schwartz (Dissertation Advisor) c David Bacon, 1999 Permission to reproduce this work in whole or in part for non-commercial purposes is hereby granted, provided that this notice and the reference http://www.cs.nyu.edu/bacon/phd-thesis/ remain prominently attached to the copied text. Excerpts less than one PostScript page long may be quoted without the requirement to include this notice, but must attach a bibliographic citation that mentions the author’s name, the title and year of this disser- tation, and New York University. For my children ii Acknowledgments First of all, I would like to thank my advisor, Jack Schwartz, for his support and encour- agement. I am also grateful to Ed Schonberg and Robert Dewar for many interesting and helpful discussions, particularly during my early days at NYU. Terry Boult (of Lehigh University) and Richard Wallace have contributed materially to my later work on SETL through grants from the NSF and from ARPA. Finally, I am indebted to my parents, who gave me the strength and will to bring this labor of love to what I hope will be a propitious beginning. iii Preface Colin Broughton, a colleague in Edmonton, Canada, first made me aware of SETL in 1980, when he saw the heavy use I was making of associative tables in SPITBOL for data processing in a protein X-ray crystallography laboratory.
    [Show full text]
  • About ILE C/C++ Compiler Reference
    IBM i 7.3 Programming IBM Rational Development Studio for i ILE C/C++ Compiler Reference IBM SC09-4816-07 Note Before using this information and the product it supports, read the information in “Notices” on page 121. This edition applies to IBM® Rational® Development Studio for i (product number 5770-WDS) and to all subsequent releases and modifications until otherwise indicated in new editions. This version does not run on all reduced instruction set computer (RISC) models nor does it run on CISC models. This document may contain references to Licensed Internal Code. Licensed Internal Code is Machine Code and is licensed to you under the terms of the IBM License Agreement for Machine Code. © Copyright International Business Machines Corporation 1993, 2015. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents ILE C/C++ Compiler Reference............................................................................... 1 What is new for IBM i 7.3.............................................................................................................................3 PDF file for ILE C/C++ Compiler Reference.................................................................................................5 About ILE C/C++ Compiler Reference......................................................................................................... 7 Prerequisite and Related Information..................................................................................................
    [Show full text]
  • TANGO Device
    School on TANGO Controls system Basics of TANGO Lorenzo Pivetta Claudio Scafuri Graziano Scalamera http://www.tango-controls.org L.Pivetta, C.Scafuri, G.Scalamera School on TANGO Control System - Trieste 4-8th July 2016 2 Prerequisites To better understand the training a background on the following arguments is desirable: ● Programming language ● Object oriented programming ● Linux/UNIX operating system ● Networking ● Control systems L.Pivetta, C.Scafuri, G.Scalamera School on TANGO Control System - Trieste 4-8th July 2016 3 Outline 1 - What is TANGO? 2 - TANGO architecture Language/OS/Compilers Device hierarchy CORBA and ZeroMQ TANGO domains TANGO device and device server TANGO Database Communication models 3 - TANGO configuration/tools Multicast Jive Polling Starter/Astor Events Pogo Alarms TANGO installation Groups Client basics TANGO ACL Logging system Historical DataBase 4 – Examples Test device L.Pivetta, C.Scafuri, G.Scalamera School on TANGO Control System - Trieste 4-8th July 2016 4 What is TANGO? Scientific workspaces Native client applications In short: Industrial SCADA Control system framework TANGO Based on CORBA and ZMQ C++ TANGO Java Archiving Python System Centralized config. database TANGO TANGO TANGO TANGO Clients binding binding binding binding (CLI/GUI) Software bus for distributed TANGO software bus objects Provides unified interface to Device Device Device Device Device Device Device Server Server Server Server Server Server Server all equipments hiding how they are HV ps + Pylon OPC UA Data Motion TANGO SNMP connected/managed
    [Show full text]
  • 101 Useful Linux Commands - Haydenjames.Io
    101 Useful Linux Commands - haydenjames.io Some of these commands require elevated permissions (sudo) to run. Enjoy! 1. Execute the previous command used: !! 2. Execute a previous command starting with a specific letter. Example: !s 3. Short way to copy or backup a file before you edit it. For example, copy nginx.conf cp nginx.conf{,.bak} 4. Toggle between current directory and last directory cd - 5. Move to parent (higher level) directory. Note the space! cd .. 6. Go to home directory cd ~ 7. Go to home directory cd $HOME 8. Go to home directory (when used alone) cd 9. Set permissions to 755. Corresponds to these permissions: (-rwx-r-x-r-x), arranged in this sequence: (owner-group-other) chmod 755 <filename> 10. Add execute permission to all users. chmod a+x <filename> 11. Changes ownership of a file or directory to . chown <username> 12. Make a backup copy of a file (named file.backup) cp <file> <file>.backup 13. Copy file1, use it to create file2 cp <file1> <file2> 14. Copy directory1 and all its contents (recursively) into directory2 cp -r <directory1> <directory2>/ 15. Display date date 16. Zero the sdb drive. You may want to use GParted to format the drive afterward. You need elevated permissions to run this (sudo). dd if=/dev/zero of=/dev/sdb 17. Display disk space usage df -h 18. Take detailed messages from OS and input to text file dmesg>dmesg.txt 19. Display a LOT of system information. I usually pipe output to less. You need elevated permissions to run this (sudo).
    [Show full text]
  • Technical Study Desktop Internationalization
    Technical Study Desktop Internationalization NIC CH A E L T S T U D Y [This page intentionally left blank] X/Open Technical Study Desktop Internationalisation X/Open Company Ltd. December 1995, X/Open Company Limited All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior permission of the copyright owners. X/Open Technical Study Desktop Internationalisation X/Open Document Number: E501 Published by X/Open Company Ltd., U.K. Any comments relating to the material contained in this document may be submitted to X/Open at: X/Open Company Limited Apex Plaza Forbury Road Reading Berkshire, RG1 1AX United Kingdom or by Electronic Mail to: [email protected] ii X/Open Technical Study (1995) Contents Chapter 1 Internationalisation.............................................................................. 1 1.1 Introduction ................................................................................................. 1 1.2 Character Sets and Encodings.................................................................. 2 1.3 The C Programming Language................................................................ 5 1.4 Internationalisation Support in POSIX .................................................. 6 1.5 Internationalisation Support in the X/Open CAE............................... 7 1.5.1 XPG4 Facilities.........................................................................................
    [Show full text]
  • 10 Programming Languages You Should Learn Right Now by Deborah Rothberg September 15, 2006 8 Comments Posted Add Your Opinion
    10 Programming Languages You Should Learn Right Now By Deborah Rothberg September 15, 2006 8 comments posted Add your opinion Knowing a handful of programming languages is seen by many as a harbor in a job market storm, solid skills that will be marketable as long as the languages are. Yet, there is beauty in numbers. While there may be developers who have had riches heaped on them by knowing the right programming language at the right time in the right place, most longtime coders will tell you that periodically learning a new language is an essential part of being a good and successful Web developer. "One of my mentors once told me that a programming language is just a programming language. It doesn't matter if you're a good programmer, it's the syntax that matters," Tim Huckaby, CEO of San Diego-based software engineering company CEO Interknowlogy.com, told eWEEK. However, Huckaby said that while his company is "swimmi ng" in work, he's having a nearly impossible time finding recruits, even on the entry level, that know specific programming languages. "We're hiring like crazy, but we're not having an easy time. We're just looking for attitude and aptitude, kids right out of school that know .Net, or even Java, because with that we can train them on .Net," said Huckaby. "Don't get fixated on one or two languages. When I started in 1969, FORTRAN, COBOL and S/360 Assembler were the big tickets. Today, Java, C and Visual Basic are. In 10 years time, some new set of languages will be the 'in thing.' …At last count, I knew/have learned over 24 different languages in over 30 years," Wayne Duqaine, director of Software Development at Grandview Systems, of Sebastopol, Calif., told eWEEK.
    [Show full text]
  • Unix Standardization and Implementation
    Contents 1. Preface/Introduction 2. Standardization and Implementation 3. File I/O 4. Standard I/O Library 5. Files and Directories 6. System Data Files and Information 7. Environment of a Unix Process 8. Process Control 9. Signals 10.Inter-process Communication * All rights reserved, Tei-Wei Kuo, National Taiwan University, 2003. Standardization and Implementation Why Standardization? Proliferation of UNIX versions What should be done? The specifications of limits that each implementation must define! * All rights reserved, Tei-Wei Kuo, National Taiwan University, 2003. 1 UNIX Standardization ANSI C American National Standards Institute ISO/IEC 9899:1990 International Organization for Standardization (ISO) Syntax/Semantics of C, a standard library Purpose: Provide portability of conforming C programs to a wide variety of OS’s. 15 areas: Fig 2.1 – Page 27 * All rights reserved, Tei-Wei Kuo, National Taiwan University, 2003. UNIX Standardization ANSIC C <assert.h> - verify program assertion <ctype.h> - char types <errno.h> - error codes <float.h> - float point constants <limits.h> - implementation constants <locale.h> - locale catalogs <math.h> - mathematical constants <setjmp.h> - nonlocal goto <signal.h> - signals <stdarg.h> - variable argument lists <stddef.h> - standard definitions <stdio.h> - standard library <stdlib.h> - utilities functions <string.h> - string operations <time.h> - time and date * All rights reserved, Tei-Wei Kuo, National Taiwan University, 2003. 2 UNIX Standardization POSIX.1 (Portable Operating System Interface) developed by IEEE Not restricted for Unix-like systems and no distinction for system calls and library functions Originally IEEE Standard 1003.1-1988 1003.2: shells and utilities, 1003.7: system administrator, > 15 other communities Published as IEEE std 1003.1-1990, ISO/IEC9945-1:1990 New: the inclusion of symbolic links No superuser notion * All rights reserved, Tei-Wei Kuo, National Taiwan University, 2003.
    [Show full text]
  • “Linux at the Command Line” Don Johnson of BU IS&T  We’Ll Start with a Sign in Sheet
    “Linux at the Command Line” Don Johnson of BU IS&T We’ll start with a sign in sheet. We’ll end with a class evaluation. We’ll cover as much as we can in the time allowed; if we don’t cover everything, you’ll pick it up as you continue working with Linux. This is a hands-on, lab class; ask questions at any time. Commands for you to type are in BOLD The Most Common O/S Used By BU Researchers When Working on a Server or Computer Cluster Linux is a Unix clone begun in 1991 and written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. 64% of the world’s servers run some variant of Unix or Linux. The Android phone and the Kindle run Linux. a set of small Linux is an O/S core programs written by written by Linus Richard Stallman and Torvalds and others others. They are the AND GNU utilities. http://www.gnu.org/ Network: ssh, scp Shells: BASH, TCSH, clear, history, chsh, echo, set, setenv, xargs System Information: w, whoami, man, info, which, free, echo, date, cal, df, free Command Information: man, info Symbols: |, >, >>, <, ;, ~, ., .. Filters: grep, egrep, more, less, head, tail Hotkeys: <ctrl><c>, <ctrl><d> File System: ls, mkdir, cd, pwd, mv, touch, file, find, diff, cmp, du, chmod, find File Editors: gedit, nedit You need a “xterm” emulation – software that emulates an “X” terminal and that connects using the “SSH” Secure Shell protocol. ◦ Windows Use StarNet “X-Win32:” http://www.bu.edu/tech/support/desktop/ distribution/xwindows/xwin32/ ◦ Mac OS X “Terminal” is already installed Why? Darwin, the system on which Apple's Mac OS X is built, is a derivative of 4.4BSD-Lite2 and FreeBSD.
    [Show full text]