History. Lecture 4: Modula-2 & InTouch. Modula-2. Aims Capitals. Comments. Niklaus Wirth, ETH, Switzerland. [RTCS Ch. 6.2; DMOC Ch.

Size: px
Start display at page:

Download "History. Lecture 4: Modula-2 & InTouch. Modula-2. Aims Capitals. Comments. Niklaus Wirth, ETH, Switzerland. [RTCS Ch. 6.2; DMOC Ch."

Transcription

1 Lecture 4: Modula-2 & InTouch Modula-2 overview InTouch demo [RTCS Ch. 6.2; DMOC Ch. 2] 1 History Niklaus Wirth, ETH, Switzerland 1970 Pascal 1975 Modula 1979 Modula-2, first implementation on PDP Language definition, Technical Report 1981 Compilers outside ETH Oberon operative system language less real-time emphasis Modula-3 DEC object-oriented 2 garbage collection Aims Capitals Modula-2 Facilitate the construction of large programs. The module concept. Separate Compilation. Be a hardware close systems programming language. Control over allocation. ADDRESS... Support concurrent programming. NEWPROCESS, TRANSFER, IOTRANSFER A more systematic syntax than in Pascal Reserved words are written with CAPITALS. The compiler distinguishes between capitals and non-capital characters. Comments Can be nested. (* This is a comment *) (* (* *) *) 3 4

2 Data Types INTEGER, CARDINAL, BOOLEAN, CHAR REAL ch: CHAR; ch := 'a'; ORD('A') = 65 CHR(65) = 'A' x: REAL; x := 5; (* Wrong *) x := 5.0; (* Correct *) Enumeration types optype = (plus,minus,times,divide); op : optype; op := plus; INC(op); (* minus *) DEC(op); (* plus again *) INC(op,3); (* divide *) op := VAL(optype,2); (* times *) ORD(minus); (* 1 *) 5 6 Arrays (* Modula-2 *) (* Pascal *) ARRAY [1..10] OF INTEGER; array [1..10] of integer; type Index = [1..10]; Index = 1..10; var a: ARRAY Index OF INTEGER; a: array [Index] of integer; ARRAY [1..m],[1..n] OF REAL array[1..m,1..n] of real; Strings Represented as ARRAY OF CHAR Library module Strings Records PersonType = RECORD name: ARRAY [0..79] OF CHAR: age: [0..110]; sex: (male,female); anders: PersonType; anders.age := 28; 7 8

3 ComponentType = (monitor,printer); StringType = ARRAY [0..19] OF CHAR; MechanismType = (dotmatrix,laser); Records with variant part SystemComponent = RECORD manufacturer: StringType; model: StringType; CASE kind: ComponentType OF monitor: colour: BOOLEAN; numlines, numcolumns: CARDINAL printer: mechanism: MechanismType; speed: CARDINAL Thetagfieldcanbeomitted RECORD CASE : BOOLEAN OF TRUE: a: INTEGER; FALSE:b: REAL END A record may have more than one variant part. Variant parts can be nested. component: SystemComponent; Set Types As in Pascal component.manufacturer := 'IBM'; component.kind := printer; component.speed := 10000; 9 10 Pointers Procedure Types p,q: POINTER TO CARDINAL; c: CARDINAL; c := p^; q^ := c; q^ := p^; q := p; NEW(p) allocates memory for a dynamic object of the type pointed to by p. DISPOSE(p) deallocates the memory. To use NEW and DISPOSE one must import STORAGE.ALLOCATE and STORAGE.DEALLOCATE 11 WriteProcedure = PROCEDURE(INTEGER); PROCEDURE WriteDecimal(i: INTEGER); BEGIN END WriteDecimal; PROCEDURE WriteHex(i: INTEGER); BEGIN END WriteHex; WP: WriteProcedure; BEGIN WP := WriteDecimal; WP(10); WP := WriteHex; WP(10); 12

4 Statements Conditions Assignment a := b + 3; Repetition WHILE i <= limit DO REPEAT UNTIL i > limit; 13 IF a = b THEN ELSIF a < b THEN ELSE Multiple Choice CASE color OF green: blue: red: ELSE END 14 Iteration FOR i := 1 TO n DO FOR i := 1 TO n BY 2 DO Infinite loop LOOP Statements not in Pascal Procedure call Exit from infinite loop P(a,b) EXIT; Function call Return from function procedure x := F(a,b) + 3; RETURN a + b; With reference Alternative return from procedure WITH p DO 15 RETURN 16

5 Procedures Statements not found in Modula-2 Function procedures and "ordinary" procedures Two kinds of formal parameters: variable parameters and value parameters Variable parameters preceded by go to L1; A change of a variable formal parameter affects the actual parameter (values are passed out of the procedure). (Call by reference) A value parameter gets its value by copying the value of the actual parameter Open array parameters PROCEDURE Sum(s: ARRAY OF CARDINAL): CARDINAL; i, sum: CARDINAL; BEGIN sum := 0; FOR i := 0 TO HIGH(s) DO sum := sum + s[i]; RETURN sum; END Sum; Called by v := ARRAY [m..n] OF CARDINAL; k := Sum(v); v[m] is mapped to s[0] v[n] is mapped to s[n-m] HIGH(s) = n - m Only the first index in a multi-dimensional array 19 Systems programming WORD BYTE ADDRESS (* assignment compatible with all pointer types *) PROCEDURE ADR(x:AnyType): ADDRESS; (* Returns the address of x *) PROCEDURE SIZE( v:anytype): CARDINAL; (* Returns the size needed for v *) PROCEDURE TSIZE(AnyType): CARDINAL; (* Returns the size needed for a variable of the given type *) Plus NEWPROCESS, TRANSFER, IOTRANSFER 20

6 Modules The primary difference between Pascal and Modula-2 A program consists of modules. One of the modules is the main program. The others are library modules. Separately compiled. Local modules are modules defined inside other modules not so much used. Modules act as walls. Entities declared inside a module are not visible outside the module unless they have been exported by the module. In order for another module to use an exported entity the module must import the entity. A module may import from multiple other modules. A complete Modula-2 program consists of a set of interconnected modules = dependency graph Library modules Two parts: a definition part and an implementation part. The definition part specifies the entities that the module exports. Constitutes the externally visible interface of the module. The implementation part contains the full declaration of the entity, i.e., the implementation. MODULE Main; END Main. Library modules DEFINITION MODULE M; END M. M.def IMPLEMENTATION MODULE M; END M. M.mod Main program: Main.mod 23 24

7 Import MODULE name ";" {import} {declarations} [BEGIN StatementSequence] END name "." Main Module The items that can be imported by another module must be defined in the Definition module (exported by default) import = [FROM name] IMPORT namelist ";" namelist could contain modules, procedures, variables, types, constants IMPORT M1; FROM M1 IMPORT x, y; Selective "dequalification" x and y can be referenced directly. Other exported entities of M1 can be referenced with M1.entity Definition modules Implementation modules DEFINITION MODULE name ";" {import} {definition} END name ";" definition = CONST {constant decl. ";"} {name ["=" type] ";"} {name : type ";"} ProcedureHead ";" 27 CompilationUnit = DefinitionModule [IMPLEMENTATION] ProgramModule ProgramModule = MODULE name ";" {import} {declaration} [BEGIN StatementSequence] END name "." Example IMPLEMENTATION MODULE TreeConstructor; BEGIN END TreeConstructor. 28

8 DEFINITION MODULE TreeConstructor; Opaque types A data type whose structure is hidden inside a module. The value of an opaque type must be a pointer. Thus the compiler knows how much space to allocate for a variable of an opaque type. FROM RuleHandler IMPORT GetConsequent, GetAntecedent; TreePtr; PROCEDURE MakeTree( T: Treeptr); PROCEDURE Traverse(T: TreePtr); END TreeConstructor IMPLEMENTATION MODULE TreeConstructor; Tree = RECORD TreePtr = POINTER TO Tree; END TreeConstructor. Separate compilation A change in a definition module means that all modules that import from the changed definition module must be recompiled. Then, all modules that import from the recompiled modules must be recompiled, etc. A change in an implementation module only results in a recompilation of that module

9 A Dependency Graph IMPL DEF Main Program MODULE M; Modules A powerful tool for creating large programs. B DEF IMPL Help make programs easier to modify by supporting information hiding. Help make programs more portable. Make separate compilation possible. C DEF IMPL D DEF IMPL Enable the development of libraries of resuable code DEFINITION MODULE Stack; ElementType = ; StackType; PROCEDURE Push( S: StackType, value: ElemenType); PROCEDURE Pop( S: StackType): ElementType; PROCEDURE Init( S: StackType); END Stack. DEFINITION MODULE Stack; FROM User IMPORT ElementType; StackType; PROCEDURE Push( S: StackType, value: ElemenType); PROCEDURE Pop( S: StackType): ElementType; PROCEDURE Init( S: StackType); END Stack

10 IMPLEMENTATION MODULE Stack; FROM Storage IMPORT ALLOCATE; CONST StackMax = 100; StackRange = [0..StackMax]; StackType = POINTER TO RECORD top : StackRange; s : ARRAY StackRange OF ElementType; PROCEDURE Push( S: StackType; value : ElementType); BEGIN WITH S^ DO END Push 37 InTouch Graphical User Interface (GUI) package from Wonderware Corp. Two parts: WindowMaker: graphical editor WindowViewer: run-time environment Animation Links: animated objects two types: TouchLinks DisplayLinks Scripts: command language 38 Tagname Data Dictionary Run-time database The variable of applications Variable: tagname type DDE tag types Memory tag types DDE Dynamic Data Exchange Message-based protocol from Microsoft Client-server system server: provides data client: requests data 39 40

11 A DDE Conversation Addressing Cold links: one-time requests, snapshot Hot links: the server automatically supply data to the clients whenever the data has changed Warm links: the server informs the cliens that the data has changed. The client may then request the data if needed. Three parts: Application/server name Topic name Item name Type definitions: Server; Topic; RealItem; BooleanItem; InTouch WindowViewer InTouch (NT process) DDE Server Module Tagname Data Dictionary DDE communication DDE server Kernel Process (NT thread) Real Time Kernel (NT process) 43 PROCEDURE NewServer( s name DDE primitives : Server; : ARRAY OF CHAR); This primitive creates and returns a server, s. The parameter name defines the application name for the server. PROCEDURE DisposeServer( s : Server); The server is deleted. PROCEDURE NewTopic( t : Topic; s : Server; name : ARRAY OF CHAR); A topic belonging to server s is created and returned. The name of the topic is given by name. PROCEDURE DisposeTopic( t : Topic); A topic is deleted. 44

12 PROCEDURE NewReal( r : RealItem; t : Topic; name : ARRAY OF CHAR); An item of type real belonging to topic t is created and returned. The name of the item is given by name. PROCEDURE DisposeReal( r : RealItem); An item of type real is deleted. PROCEDURE GetReal(r : RealItem) : LONGREAL; Returns the current value of the real type item r. The operation is nonblocking. PROCEDURE SetReal(r : RealItem; value : LONGREAL); Sets the value of the real type item r. If the item is requested by a DDE-client (e.g., InTouch) and the value has changed then a DDE message is sent to the client. PROCEDURE NewBoolean( r : BooleanItem; t : Topic; name : ARRAY OF CHAR); An item of type boolean belonging to topic t is created and returned. The name of the item is given by name. PROCEDURE DisposeBoolean( r : BooleanItem); An item of type boolean is deleted. PROCEDURE GetBoolean(r : BooleanItem) : BOOLEAN; Returns the current value of the boolean type item r. The operation is nonblocking. PROCEDURE SetBoolean(r : BooleanItem; value : BOOLEAN); Sets the value of the boolean type item r. If the item is requested by a DDE-client (e.g., InTouch) and the value has changed then a DDE message is sent to the client Application: Topic: Item Item Item InTouch Information DDE message Topic: GetReal DMOC Chapter 2 incl. example InTouch Getting Started InTouch User s Guide DDE message Topic: SetReal 47 48

clean way to do separate compilation. ECS140A Programming Languages 12-1

clean way to do separate compilation. ECS140A Programming Languages 12-1 Modularization separate program into different modules. motivation: separate major portions of code. improves maintainability. increases potential for reusability. e.g., scanner, parser, symbol table.

More information

Topic IV. Parameters. Chapter 5 of Programming languages: Concepts & constructs by R. Sethi (2ND EDITION). Addison-Wesley, 1996.

Topic IV. Parameters. Chapter 5 of Programming languages: Concepts & constructs by R. Sethi (2ND EDITION). Addison-Wesley, 1996. References: Topic IV Block-structured procedural languages Algol and Pascal Chapters 5 and 7, of Concepts in programming languages by J. C. Mitchell. CUP, 2003. Chapter 5 of Programming languages: Concepts

More information

Topic IV. Block-structured procedural languages Algol and Pascal. References:

Topic IV. Block-structured procedural languages Algol and Pascal. References: References: Topic IV Block-structured procedural languages Algol and Pascal Chapters 5 and 7, of Concepts in programming languages by J. C. Mitchell. CUP, 2003. Chapters 10( 2) and 11( 1) of Programming

More information

Today's Topics. CISC 458 Winter J.R. Cordy

Today's Topics. CISC 458 Winter J.R. Cordy Today's Topics Last Time Semantics - the meaning of program structures Stack model of expression evaluation, the Expression Stack (ES) Stack model of automatic storage, the Run Stack (RS) Today Managing

More information

The ACK Modula-2 Compiler

The ACK Modula-2 Compiler The ACK Modula-2 Compiler Ceriel J.H. Jacobs Department of Mathematics and Computer Science Vrije Universiteit Amsterdam The Netherlands 1. Introduction This document describes the implementation-specific

More information

The PCAT Programming Language Reference Manual

The PCAT Programming Language Reference Manual The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language

More information

Chapter 11. Abstract Data Types and Encapsulation Concepts

Chapter 11. Abstract Data Types and Encapsulation Concepts Chapter 11 Abstract Data Types and Encapsulation Concepts Chapter 11 Topics The Concept of Abstraction Introduction to Data Abstraction Design Issues for Abstract Data Types Language Examples Parameterized

More information

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language

Features of C. Portable Procedural / Modular Structured Language Statically typed Middle level language 1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC

More information

Chapter 11. Abstract Data Types and Encapsulation Concepts

Chapter 11. Abstract Data Types and Encapsulation Concepts Chapter 11 Abstract Data Types and Encapsulation Concepts Chapter 11 Topics The Concept of Abstraction Introduction to Data Abstraction Design Issues for Abstract Data Types Language Examples Parameterized

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 2 Thomas Wies New York University Review Last week Programming Languages Overview Syntax and Semantics Grammars and Regular Expressions High-level

More information

Chapter 11. Abstract Data Types and Encapsulation Concepts ISBN

Chapter 11. Abstract Data Types and Encapsulation Concepts ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts ISBN 0-321-49362-1 Chapter 11 Topics The Concept of Abstraction Introduction to Data Abstraction Design Issues for Abstract Data Types Language

More information

Introduction to Programming Using Java (98-388)

Introduction to Programming Using Java (98-388) Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;

More information

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find

CS1622. Semantic Analysis. The Compiler So Far. Lecture 15 Semantic Analysis. How to build symbol tables How to use them to find CS1622 Lecture 15 Semantic Analysis CS 1622 Lecture 15 1 Semantic Analysis How to build symbol tables How to use them to find multiply-declared and undeclared variables. How to perform type checking CS

More information

CSE P 501 Compilers. Static Semantics Hal Perkins Winter /22/ Hal Perkins & UW CSE I-1

CSE P 501 Compilers. Static Semantics Hal Perkins Winter /22/ Hal Perkins & UW CSE I-1 CSE P 501 Compilers Static Semantics Hal Perkins Winter 2008 1/22/2008 2002-08 Hal Perkins & UW CSE I-1 Agenda Static semantics Types Attribute grammars Representing types Symbol tables Note: this covers

More information

Flow Control. CSC215 Lecture

Flow Control. CSC215 Lecture Flow Control CSC215 Lecture Outline Blocks and compound statements Conditional statements if - statement if-else - statement switch - statement? : opertator Nested conditional statements Repetitive statements

More information

Programming Languages Third Edition. Chapter 7 Basic Semantics

Programming Languages Third Edition. Chapter 7 Basic Semantics Programming Languages Third Edition Chapter 7 Basic Semantics Objectives Understand attributes, binding, and semantic functions Understand declarations, blocks, and scope Learn how to construct a symbol

More information

NOTE: Answer ANY FOUR of the following 6 sections:

NOTE: Answer ANY FOUR of the following 6 sections: A-PDF MERGER DEMO Philadelphia University Lecturer: Dr. Nadia Y. Yousif Coordinator: Dr. Nadia Y. Yousif Internal Examiner: Dr. Raad Fadhel Examination Paper... Programming Languages Paradigms (750321)

More information

SE352b: Roadmap. SE352b Software Engineering Design Tools. W3: Programming Paradigms

SE352b: Roadmap. SE352b Software Engineering Design Tools. W3: Programming Paradigms SE352b Software Engineering Design Tools W3: Programming Paradigms Feb. 3, 2005 SE352b, ECE,UWO, Hamada Ghenniwa SE352b: Roadmap CASE Tools: Introduction System Programming Tools Programming Paradigms

More information

Symbol Tables. ASU Textbook Chapter 7.6, 6.5 and 6.3. Tsan-sheng Hsu.

Symbol Tables. ASU Textbook Chapter 7.6, 6.5 and 6.3. Tsan-sheng Hsu. Symbol Tables ASU Textbook Chapter 7.6, 6.5 and 6.3 Tsan-sheng Hsu tshsu@iis.sinica.edu.tw http://www.iis.sinica.edu.tw/~tshsu 1 Definitions Symbol table: A data structure used by a compiler to keep track

More information

C-LANGUAGE CURRICULAM

C-LANGUAGE CURRICULAM C-LANGUAGE CURRICULAM Duration: 2 Months. 1. Introducing C 1.1 History of C Origin Standardization C-Based Languages 1.2 Strengths and Weaknesses Of C Strengths Weaknesses Effective Use of C 2. C Fundamentals

More information

Data Types. Outline. In Text: Chapter 6. What is a type? Primitives Strings Ordinals Arrays Records Sets Pointers 5-1. Chapter 6: Data Types 2

Data Types. Outline. In Text: Chapter 6. What is a type? Primitives Strings Ordinals Arrays Records Sets Pointers 5-1. Chapter 6: Data Types 2 Data Types In Text: Chapter 6 1 Outline What is a type? Primitives Strings Ordinals Arrays Records Sets Pointers Chapter 6: Data Types 2 5-1 Data Types Two components: Set of objects in the type (domain

More information

Abstract data types &

Abstract data types & Abstract Data Types & Object-Oriented Programming COS 301 - Programming Languages Chapters 11 & 12 in the book Slides are heavily based on Sebesta s slides for the chapters, with much left out! Abstract

More information

Abstract Data Types & Object-Oriented Programming

Abstract Data Types & Object-Oriented Programming Abstract Data Types & Object-Oriented Programming COS 301 - Programming Languages Chapters 11 & 12 in the book Slides are heavily based on Sebesta s slides for the chapters, with much left out! Abstract

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter

More information

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS

AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this

More information

UNIT 3

UNIT 3 UNIT 3 Presentation Outline Sequence control with expressions Conditional Statements, Loops Exception Handling Subprogram definition and activation Simple and Recursive Subprogram Subprogram Environment

More information

Why Pointers. Pointers. Pointer Declaration. Two Pointer Operators. What Are Pointers? Memory address POINTERVariable Contents ...

Why Pointers. Pointers. Pointer Declaration. Two Pointer Operators. What Are Pointers? Memory address POINTERVariable Contents ... Why Pointers Pointers They provide the means by which functions can modify arguments in the calling function. They support dynamic memory allocation. They provide support for dynamic data structures, such

More information

UNIT-4 (COMPILER DESIGN)

UNIT-4 (COMPILER DESIGN) UNIT-4 (COMPILER DESIGN) An important part of any compiler is the construction and maintenance of a dictionary containing names and their associated values, such type of dictionary is called a symbol table.

More information

Abstract Data Types and Encapsulation Concepts

Abstract Data Types and Encapsulation Concepts Abstract Data Types and Encapsulation Concepts The Concept of Abstraction An abstraction is a view or representation of an entity that includes only the most significant attributes The concept of abstraction

More information

Data Types In Text: Ch C apter 6 1

Data Types In Text: Ch C apter 6 1 Data Types In Text: Chapter 6 1 Outline What is a type? Primitives Strings Ordinals Arrays Records Sets Pointers 2 Data Types Two components: Set of objects in the type (domain of values) Set of applicable

More information

Classes and Methods לאוניד ברנבוים המחלקה למדעי המחשב אוניברסיטת בן-גוריון

Classes and Methods לאוניד ברנבוים המחלקה למדעי המחשב אוניברסיטת בן-גוריון Classes and Methods לאוניד ברנבוים המחלקה למדעי המחשב אוניברסיטת בן-גוריון 22 Roadmap Lectures 4 and 5 present two sides of OOP: Lecture 4 discusses the static, compile time representation of object-oriented

More information

Question No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given

Question No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given MUHAMMAD FAISAL MIT 4 th Semester Al-Barq Campus (VGJW01) Gujranwala faisalgrw123@gmail.com MEGA File Solved MCQ s For Final TERM EXAMS CS508- Modern Programming Languages Question No: 1 ( Marks: 1 ) -

More information

LECTURE 18. Control Flow

LECTURE 18. Control Flow LECTURE 18 Control Flow CONTROL FLOW Sequencing: the execution of statements and evaluation of expressions is usually in the order in which they appear in a program text. Selection (or alternation): a

More information

Section 5: Pascal. Evolution of Software Languages

Section 5: Pascal. Evolution of Software Languages Section 5: Pascal Evolution of Software Languages Theo D'Hondt Bachelor of Computer Science Faculty of Sciences and Bio-Engineering Sciences Vrije Universiteit Brussel Academic Year 2015-2016 Evolution

More information

Tuple Abstract Data Type

Tuple Abstract Data Type 1 Tuple Abstract Data Type Table of Contents Introduction... 1 The tuple object... 2 The tuple fields... 3 Operations on tuples... 4 Enquiry operations... 4.1 Read operations... 4.2 Write operations...

More information

G Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University

G Programming Languages Spring 2010 Lecture 4. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 4 Robert Grimm, New York University 1 Review Last week Control Structures Selection Loops 2 Outline Subprograms Calling Sequences Parameter Passing

More information

Run Time Environment

Run Time Environment CS 403 Compiler Construction Lecture 12 Run Time Environment and Management [Based on Chapter 7 of Aho2] 1 Run Time Environment From Lecture 1 to 11, we have seen many jobs that are done by a compiler.

More information

Compiler Construction

Compiler Construction Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Recap: Static Data Structures Outline of Lecture 18 Recap:

More information

Classes and Methods גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון

Classes and Methods גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון Classes and Methods גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון 2 Roadmap Lectures 4 and 5 present two sides of OOP: Lecture 4 discusses the static, compile time representation of object-oriented

More information

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100

Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 Code: DC-05 Subject: PROBLEM SOLVING THROUGH C Time: 3 Hours Max. Marks: 100 NOTE: There are 11 Questions in all. Question 1 is compulsory and carries 16 marks. Answer to Q. 1. must be written in the space

More information

Compiler Construction

Compiler Construction Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Seminar Analysis and Verification of Pointer Programs (WS

More information

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline

CS 330 Lecture 18. Symbol table. C scope rules. Declarations. Chapter 5 Louden Outline CS 0 Lecture 8 Chapter 5 Louden Outline The symbol table Static scoping vs dynamic scoping Symbol table Dictionary associates names to attributes In general: hash tables, tree and lists (assignment ) can

More information

Chapter 11. Abstract Data Types and Encapsulation Concepts 抽象数据类型 与封装结构. 孟小亮 Xiaoliang MENG, 答疑 ISBN

Chapter 11. Abstract Data Types and Encapsulation Concepts 抽象数据类型 与封装结构. 孟小亮 Xiaoliang MENG, 答疑   ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts 抽象数据类型 与封装结构 孟小亮 Xiaoliang MENG, 答疑 EMAIL: 1920525866@QQ.COM ISBN 0-321-49362-1 Chapter 11 Topics The Concept of Abstraction Introduction to Data

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

History. used in early Mac development notable systems in Pascal Skype TeX embedded systems

History. used in early Mac development notable systems in Pascal Skype TeX embedded systems Overview The Pascal Programming Language (with material from tutorialspoint.com) Background & History Features Hello, world! General Syntax Variables/Data Types Operators Conditional Statements Functions

More information

Implementing Subprograms

Implementing Subprograms Implementing Subprograms 1 Topics The General Semantics of Calls and Returns Implementing Simple Subprograms Implementing Subprograms with Stack-Dynamic Local Variables Nested Subprograms Blocks Implementing

More information

Principles of Programming Languages Topic: Scope and Memory Professor Louis Steinberg Fall 2004

Principles of Programming Languages Topic: Scope and Memory Professor Louis Steinberg Fall 2004 Principles of Programming Languages Topic: Scope and Memory Professor Louis Steinberg Fall 2004 CS 314, LS,BR,LTM: Scope and Memory 1 Review Functions as first-class objects What can you do with an integer?

More information

University of Arizona, Department of Computer Science. CSc 520 Assignment 4 Due noon, Wed, Apr 6 15% Christian Collberg March 23, 2005

University of Arizona, Department of Computer Science. CSc 520 Assignment 4 Due noon, Wed, Apr 6 15% Christian Collberg March 23, 2005 University of Arizona, Department of Computer Science CSc 520 Assignment 4 Due noon, Wed, Apr 6 15% Christian Collberg March 23, 2005 1 Introduction Your task is to write an interpreter and a garbage collector

More information

OBJECT ORIENTED PROGRAMMING USING C++

OBJECT ORIENTED PROGRAMMING USING C++ OBJECT ORIENTED PROGRAMMING USING C++ Abstract Data Types and Encapsulation Concepts ISBN 0-321-33025-0 Chapter 11 Topics The Concept of Abstraction Introduction to Data Abstraction Design Issues for Abstract

More information

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309

Index. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309 A Arithmetic operation floating-point arithmetic, 11 12 integer numbers, 9 11 Arrays, 97 copying, 59 60 creation, 48 elements, 48 empty arrays and vectors, 57 58 executable program, 49 expressions, 48

More information

Table of Contents. Initial Configuration of Runtime Workstation SMSI Server Development System OpenHMI P/N A 1-1

Table of Contents. Initial Configuration of Runtime Workstation SMSI Server Development System OpenHMI P/N A 1-1 Table of Contents Initial Configuration of Runtime Workstation... 2 SMSI Server... 7 Development System... 12 OpenHMI... 18 P/N 350012-A 1-1 The Xycom Automation Profibus slave communication module, (from

More information

SEMANTIC ANALYSIS TYPES AND DECLARATIONS

SEMANTIC ANALYSIS TYPES AND DECLARATIONS SEMANTIC ANALYSIS CS 403: Type Checking Stefan D. Bruda Winter 2015 Parsing only verifies that the program consists of tokens arranged in a syntactically valid combination now we move to check whether

More information

Modules. Cardelli, 1996

Modules. Cardelli, 1996 SDI LC90 E Dot Inc Modules Program modularization arose from the necessity of splitting large programs into fragments in order to compile them.... It was soon realized that modularization had great advantages

More information

Annex A (Informative) Collected syntax The nonterminal symbols pointer-type, program, signed-number, simple-type, special-symbol, and structured-type

Annex A (Informative) Collected syntax The nonterminal symbols pointer-type, program, signed-number, simple-type, special-symbol, and structured-type Pascal ISO 7185:1990 This online copy of the unextended Pascal standard is provided only as an aid to standardization. In the case of dierences between this online version and the printed version, the

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

CSc 520. The Oberon Programming Language Report. Manish Swaminathan, Bharathwaj 05/14/2008

CSc 520. The Oberon Programming Language Report. Manish Swaminathan, Bharathwaj 05/14/2008 1 CSc 520 The Oberon Programming Language Report Manish Swaminathan, Bharathwaj Spring 2008 05/14/2008 2 Contents 1. Introduction & History of the Language:... 3 2. Procedures:... 3 2.1 Procedure forward

More information

Compiler Construction

Compiler Construction Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-17/cc/ Generation of Intermediate Code Outline of Lecture 15 Generation

More information

CSE 307: Principles of Programming Languages

CSE 307: Principles of Programming Languages 1 / 26 CSE 307: Principles of Programming Languages Names, Scopes, and Bindings R. Sekar 2 / 26 Topics Bindings 1. Bindings Bindings: Names and Attributes Names are a fundamental abstraction in languages

More information

CFB Software. Astrobe. ARM Cortex-M Oberon Programmers Guide

CFB Software. Astrobe. ARM Cortex-M Oberon Programmers Guide CFB Software Astrobe ARM Cortex-M Oberon Programmers Guide This document is generally applicable to all ARM Cortex-M editions of Astrobe. It shows Oberon programmers how the Astrobe implementation of Oberon

More information

Informatica 3 Syntax and Semantics

Informatica 3 Syntax and Semantics Informatica 3 Syntax and Semantics Marcello Restelli 9/15/07 Laurea in Ingegneria Informatica Politecnico di Milano Introduction Introduction to the concepts of syntax and semantics Binding Variables Routines

More information

Programmin Languages/Variables and Storage

Programmin Languages/Variables and Storage Programmin Languages/Variables and Storage Onur Tolga Şehitoğlu Computer Engineering 4 Mart 2007 Outline 1 Storage Array Variables 2 Semantics of Assignment 3 Variable Lifetime Global Lifetime Local Lifetime

More information

Table of Contents. Initial Configuration of Runtime Workstation SMSI Server Development System OpenHMI P/N A 1-1

Table of Contents. Initial Configuration of Runtime Workstation SMSI Server Development System OpenHMI P/N A 1-1 Table of Contents Initial Configuration of Runtime Workstation... 2 SMSI Server... 7 Development System... 12 OpenHMI... 19 P/N 350014-A 1-1 The Xycom Automation DeviceNet slave communication module, (from

More information

Index. Numerics 0X String sentinel 65, Invariant violation Precondition violation 120

Index. Numerics 0X String sentinel 65, Invariant violation Precondition violation 120 B B Index Symbols # Not equal to 87 $ String selector 68, 333 & And 88 * Export mark 36 * Multiplication 51, 54, 58 + Addition 51, 54, 58 + Concatenation 66 + UML public 540, 563 - Read-only export mark

More information

CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science Department Lecture 3: C# language basics Lecture Contents 2 C# basics Conditions Loops Methods Arrays Dr. Amal Khalifa, Spr 2015 3 Conditions and

More information

Lecture 11: Subprograms & their implementation. Subprograms. Parameters

Lecture 11: Subprograms & their implementation. Subprograms. Parameters Lecture 11: Subprograms & their implementation Subprograms Parameter passing Activation records The run-time stack Implementation of static and dynamic scope rules Subprograms A subprogram is a piece of

More information

Recovering a Corrupted InTouch Application

Recovering a Corrupted InTouch Application Page 1 of 7 Tech Note 112 Recovering a Corrupted InTouch Application All Tech Notes and KBCD documents and software are provided "as is" without warranty of any kind. See the Terms of Use for more information.

More information

520 Principles of Programming Languages. Arithmetic. Variable Declarations. 19: Pascal

520 Principles of Programming Languages. Arithmetic. Variable Declarations. 19: Pascal Structure of a Pascal Program 520 Principles of Programming Languages 19: Pascal Christian Collberg collberg@cs.arizona.edu Department of Computer Science University of Arizona PROGRAM Name (list of files);

More information

Review for Test 1 (Chapter 1-5)

Review for Test 1 (Chapter 1-5) Review for Test 1 (Chapter 1-5) 1. Introduction to Computers, Programs, and Java a) What is a computer? b) What is a computer program? c) A bit is a binary digit 0 or 1. A byte is a sequence of 8 bits.

More information

About Codefrux While the current trends around the world are based on the internet, mobile and its applications, we try to make the most out of it. As for us, we are a well established IT professionals

More information

CMSC 4023 Chapter 11

CMSC 4023 Chapter 11 11. Topics The Concept of Abstraction Introduction to Data Abstraction Design Issues for Abstract Data Types Language Examples Parameterized Abstract Data Types Encapsulation Constructs Naming Encapsulations

More information

Compiler Construction

Compiler Construction Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Seminar Analysis and Verification of Pointer Programs (WS

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss Chapter 1 terminology (parenthesized numbers are page numbers) Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement

More information

10. Abstract Data Types

10. Abstract Data Types 10. Abstract Data Types 11.1 The Concept of Abstraction The concept of abstraction is fundamental in programming Nearly all programming languages support process abstraction with subprograms Nearly all

More information

Review of the C Programming Language

Review of the C Programming Language Review of the C Programming Language Prof. James L. Frankel Harvard University Version of 11:55 AM 22-Apr-2018 Copyright 2018, 2016, 2015 James L. Frankel. All rights reserved. Reference Manual for the

More information

System Software Assignment 1 Runtime Support for Procedures

System Software Assignment 1 Runtime Support for Procedures System Software Assignment 1 Runtime Support for Procedures Exercise 1: Nested procedures Some programming languages like Oberon and Pascal support nested procedures. 1. Find a run-time structure for such

More information

Exam 1 Prep. Dr. Demetrios Glinos University of Central Florida. COP3330 Object Oriented Programming

Exam 1 Prep. Dr. Demetrios Glinos University of Central Florida. COP3330 Object Oriented Programming Exam 1 Prep Dr. Demetrios Glinos University of Central Florida COP3330 Object Oriented Programming Progress Exam 1 is a Timed Webcourses Quiz You can find it from the "Assignments" link on Webcourses choose

More information

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.

Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java

More information

CSCI312 Principles of Programming Languages!

CSCI312 Principles of Programming Languages! CSCI312 Principles of Programming Languages! Scope Xu Liu ! 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!

More information

CSc 520 Principles of Programming Languages. 26 : Control Structures Introduction

CSc 520 Principles of Programming Languages. 26 : Control Structures Introduction CSc 520 Principles of Programming Languages 26 : Control Structures Introduction Christian Collberg Department of Computer Science University of Arizona collberg+520@gmail.com Copyright c 2008 Christian

More information

A Short Summary of Javali

A Short Summary of Javali A Short Summary of Javali October 15, 2015 1 Introduction Javali is a simple language based on ideas found in languages like C++ or Java. Its purpose is to serve as the source language for a simple compiler

More information

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 23 Introduction to Arduino- II Hi. Now, we will continue

More information

CS11 Java. Fall Lecture 1

CS11 Java. Fall Lecture 1 CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon

More information

[0569] p 0318 garbage

[0569] p 0318 garbage A Pointer is a variable which contains the address of another variable. Declaration syntax: Pointer_type *pointer_name; This declaration will create a pointer of the pointer_name which will point to the

More information

Programmiersprachen (Programming Languages)

Programmiersprachen (Programming Languages) 2016-05-13 Preface Programmiersprachen (Programming Languages) coordinates: lecturer: web: usable for: requirements: No. 185.208, VU, 3 ECTS Franz Puntigam http://www.complang.tuwien.ac.at/franz/ps.html

More information

The SPL Programming Language Reference Manual

The SPL Programming Language Reference Manual The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming

More information

Lecture 1: Overview of Java

Lecture 1: Overview of Java Lecture 1: Overview of Java What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed for easy Web/Internet applications Widespread

More information

Data Structure for Language Processing. Bhargavi H. Goswami Assistant Professor Sunshine Group of Institutions

Data Structure for Language Processing. Bhargavi H. Goswami Assistant Professor Sunshine Group of Institutions Data Structure for Language Processing Bhargavi H. Goswami Assistant Professor Sunshine Group of Institutions INTRODUCTION: Which operation is frequently used by a Language Processor? Ans: Search. This

More information

CSCI 171 Chapter Outlines

CSCI 171 Chapter Outlines Contents CSCI 171 Chapter 1 Overview... 2 CSCI 171 Chapter 2 Programming Components... 3 CSCI 171 Chapter 3 (Sections 1 4) Selection Structures... 5 CSCI 171 Chapter 3 (Sections 5 & 6) Iteration Structures

More information

Modularity. Modular program development. Language support for modularity. Step-wise refinement Interface, specification, and implementation

Modularity. Modular program development. Language support for modularity. Step-wise refinement Interface, specification, and implementation Modular program development Step-wise refinement Interface, specification, and implementation Language support for modularity Procedural abstraction Abstract data types Packages and modules Generic abstractions

More information

Chapter 5 Names, Binding, Type Checking and Scopes

Chapter 5 Names, Binding, Type Checking and Scopes Chapter 5 Names, Binding, Type Checking and Scopes Names - We discuss all user-defined names here - Design issues for names: -Maximum length? - Are connector characters allowed? - Are names case sensitive?

More information

Unit 2 : Computer and Operating System Structure

Unit 2 : Computer and Operating System Structure Unit 2 : Computer and Operating System Structure Lesson 1 : Interrupts and I/O Structure 1.1. Learning Objectives On completion of this lesson you will know : what interrupt is the causes of occurring

More information

Data Structures and Algorithms for Engineers

Data Structures and Algorithms for Engineers 04-630 Data Structures and Algorithms for Engineers David Vernon Carnegie Mellon University Africa vernon@cmu.edu www.vernon.eu Data Structures and Algorithms for Engineers 1 Carnegie Mellon University

More information

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \ BSc IT C Programming (2013-2017) Unit I Q1. What do you understand by type conversion? (2013) Q2. Why we need different data types? (2013) Q3 What is the output of the following (2013) main() Printf( %d,

More information

Michele Van Dyne Museum 204B CSCI 136: Fundamentals of Computer Science II, Spring

Michele Van Dyne Museum 204B  CSCI 136: Fundamentals of Computer Science II, Spring Michele Van Dyne Museum 204B mvandyne@mtech.edu http://katie.mtech.edu/classes/csci136 CSCI 136: Fundamentals of Computer Science II, Spring 2016 1 Review of Java Basics Data Types Arrays NEW: multidimensional

More information

CS558 Programming Languages Winter 2018 Lecture 4a. Andrew Tolmach Portland State University

CS558 Programming Languages Winter 2018 Lecture 4a. Andrew Tolmach Portland State University CS558 Programming Languages Winter 2018 Lecture 4a Andrew Tolmach Portland State University 1994-2018 Pragmatics of Large Values Real machines are very efficient at handling word-size chunks of data (e.g.

More information

Final Exam. 11 May 2018, 120 minutes, 26 questions, 100 points

Final Exam. 11 May 2018, 120 minutes, 26 questions, 100 points Name: CS520 Final Exam 11 May 2018, 120 minutes, 26 questions, 100 points The exam is closed book and notes. Please keep all electronic devices turned off and out of reach. Note that a question may require

More information

Compiler Construction

Compiler Construction Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-17/cc/ Generation of Intermediate Code Conceptual Structure of

More information

Multiple Choice Questions. Chapter 5

Multiple Choice Questions. Chapter 5 Multiple Choice Questions Chapter 5 Each question has four choices. Choose most appropriate choice of the answer. 1. Developing program in high level language (i) facilitates portability of nonprocessor

More information

Goals of this Lecture

Goals of this Lecture C Pointers Goals of this Lecture Help you learn about: Pointers and application Pointer variables Operators & relation to arrays 2 Pointer Variables The first step in understanding pointers is visualizing

More information

Example. program sort; var a : array[0..10] of integer; procedure readarray; : function partition (y, z :integer) :integer; var i, j,x, v :integer; :

Example. program sort; var a : array[0..10] of integer; procedure readarray; : function partition (y, z :integer) :integer; var i, j,x, v :integer; : Runtime Environment Relationship between names and data objects (of target machine) Allocation & de-allocation is managed by run time support package Each execution of a procedure is an activation of the

More information