A common representation for building program slicing tools

Size: px
Start display at page:

Download "A common representation for building program slicing tools"

Transcription

1 THE INSTITUTE OF ELECTRONICS, INFORMATION AND COMMUNICATION ENGINEERS TECHNICAL REPORT OF IEICE XML A common representation for building program slicing tools Kouichi TOITA, Shinichiro YAMAMOTO, and Kiyoshi AGUSA Graduate School of Engineering, Nagoya University Furo-cho, Chikusa-ku, Nagoya-shi, Aichi, Japan Facaluty of Information Sience and Technology, Aichi Prefectural University , Ibaragabasama, Kumabari, Nagakute-cho, Aichi-gun, Aichi, , Japan toita@agusa.nuie.nagoya-u.ac.jp, yamamoto@ist.aichi-pu.ac.jp, agusa@nuie.nagoya-u.ac.jp Abstract We can extract some codes that affect the selected variable by using program slicing. Program slicing is useful for software development and maintenance, e.g. debugging, testing, reuse, program understanding, refactoring, and so on. Traditional slicing tools depend on target programming languages. We can slice the programs independently of programming languages, beacuse program slicing is an abstract operation on the graph defined by language semantics. In this research, we propose a common representation for program slicing which is independent of programming languages. This common representation abstract arithmetic, repeat, select statement and so on. We propose and implement a framework for program slicing using proposed representation. When we build a slicing tool using this framework, we need only a tool which translates source programs into proposed representation. We build a slicing tool and evaluate this framework. We show that the cost for building a certain level of slicing tools decreases without this framework. Key words program slicing, dependence analysis, XML 1

2 1. Weiser [1] High level Intermediate Representation Markup Language HIRML HIRML HIRML HIRML HIRML HIRML HIRML HIRML 2. HIRML HIRML HIRML 3. HIRML 4. C Java HIRML C C++ Java Fortran Pascal HIRML HIRML HIRML HIRML C C++ HIRML HIRML count = 0; sum = 0; for i = 1 to 100 do begin if (i mod 2 = 0) and (i mod 3 <> 0) then count = count + 1; sum = sum + i; end; 2. HIRML HIRML Fig. 1 count = 0; sum = 0; for (i = 1; i <= 100; i++) { if (i % 2 == 0 && i % 3!= 0) { count++; sum += i; 1 Pascal C Pascal and C programs which execute the same process. 2

3 typedef 2. 3 HIRML HIRML XML [2] XML XML XML XML sed grep Perl XML XSLT [3] DOM [4] XML HIRML HIRML 2 HIRML XML forstmt for forstmt body step 4 body step HIRML type for (i = 0; i < 10; i++) { a += i; <forstmt id="c " offset="34" length="41" line="4" > <!-- for --> <expstmt id="c " offset="39" length="5" line="4" > <assign id="c " offset="39" length="5" line="4" > <const id="c " value="0" type="int" /> </assign> </expstmt> <!-- for --> <cmplt id="c " offset="46" length="6" line="4" > <const id="c " value="10" type="int" /> </cmplt> <!-- for body --> <blockstmt id="c " offset="59" length="16" line="4" > <expstmt id="c " offset="64" length="6" line="5" > <addassign id="c " offset="64" length="6" line="5" > <var id="c " name="a" type="int" pointer="0" /> </addassign> </expstmt> </blockstmt> <!-- for step --> <expstmt id="c " offset="54" length="3" line="4" > <postincr id="c " offset="54" length="3" line="4" > </postincr> </expstmt> </forstmt> Fig. 3 long int a; FILE *fp; <vardef id="c " name="a" type="long int" pointer="0" /> <vardef id="c " name="fp" type="file" pointer="1" /> 3 HIRML Variable declarations and corresponding HIRML. const volatile long short signed unsigned auto register public private HIRML type NMTOKENS NMTOKENS const long pointer <pointer> 4 typedef 4 HIRML struct name HIRML elemdef typedef typedef deftype name HIRML HIRML 1. HIRML 2. typedef struct _List { int data; struct _List *next; List; <struct id="c " name="_list" > <elemdef id="c " name="data" type="int" pointer="0" /> <elemdef id="c " name="next" type="struct _List" pointer="1" /> </struct> <typedef id="c " name="list" deftype="struct _List" pointer="0" /> Fig. 2 2 for HIRML A simple For statement and corresponding HIRML. Fig. 4 4 HIRML A declaration of List and corresponding HIRML. 3

4 3. HIRML HIRML HIRML slicing tool HIRML Coins HIR HIRML DGML X 5 3. HIRML 5 HIRML 3. 1 HIRML HIRML 6 HIRML Coins COmpiler INfraStructure [5] HIRML 1. HIRML HIRML Coins High level Intermediate Representation HIR 2. HIR 3. Coins Dependence Graph *.x x2hirml (HIRML) HIRML HIRML slicing tool *.x Program Slicing Framework X Slicing Tool (, ) 5 X Fig. 5 A slicing of Language X. 6 HIRML Fig. 6 An HIRML slicing tool. Markup Language DGML 4. HIRML DGML 3. 2 Coins Coins Java Coins High level Intermediate Representation HIR Low level Intermediate Representation LIR HIR HIR HIR LIR LIR Coins C SPARC Fortran Java X86 Coins HIR LIR 3. 3 HIRML Coins HIR HIRML HIRML HIR HIRML 7 HIR 7 8 HIRML 7 5 HIRML 8 HIRML

5 Fig. 7 a++; a += b; c = a > b? a b; Fig. 8 7 C, C++, Java Representations in C, C++ and Java. a = a + 1; a = a + b; if (a > b) { c = a; else { c = b; 8 Representations after translation DEF(b) b p p x b p p p KILL(b) b b p p x b p p REACH(b) p x p b path p p DEF(b) b b KILL(b) b REACH(b) = P pred(b) {DEF(P ) {REACH(P ) KILL(P ) s t s t s t HIR p p p 2 HIR s t s t REACH(b) b p b b USE(p) p DEFINE(p) p 1. p b DEFINE(p) USE(p) 2. p REACH(b) DEFINE(p) 3. p b 3.1 x USE(p) p s x x s x REACH(b) x XML XML DGML Dependence Graph Markup Language DGML program subp block predblock succblock stmt defvar usevar 9 predblock no succblock no 10 stmt cdstmtid id usevar ddstmtid id

6 block9 block8 iw == 0 iw = 1; nw = nw + 1; block11 <block no="9"> <predblock no="8"/> <succblock no="11"/> 9 DGML Fig. 9 The representation of predecessor block and successor block in DGML. block1 block8 iw == 0 block9 iw = 0; nl = 0; nw = 0; nc = 0; c = fgetc(stdin); iw = 1; nw = nw + 1; <block no="1"> <stmt id="c "> <defvar id="c " name="nw"/> <block no="8"> <stmt cdstmtid="c c " id="c "> <usevar ddstmtid="c c c " id="c " name="iw"/> <block no="9"> <stmt cdstmtid="c " id="c "> <defvar id="c " name="iw"/> <stmt cdstmtid="c " id="c "> <defvar id="c " name="nw"/> <usevar ddstmtid="c " id="c " name="nw"/> 10 DGML Fig. 10 The representation of control dependence and data dependence in DGML. HIRML DGML n v 6 1. n s f HIRML 2. s f f b DGML 3. s f v s S c 4. S c s 4.1 s u s d S c S o 4.2 s s c S c S o 4.3 s S c 5. f S S S o S r 6. S r HIRML offset length HIRML HIRML HIRML HIRML 4. 2 C HIRML C HIRML c2hirml2. 2 CASE Sapid Sophisticated APIs for CASE tooldevelopment [6] Sapid C Software DataBase SDB SDB Access Routine AR c2hirml C SDB AR HIRML c2hirml C C [7] Wisconsin Program-Slicing Tool [8] [9] Unravel [10] Unravel Unravel Unravel lex yacc C c2hirml STEP-C Slicing TEst Program for C STEP-C C if, switch, for, while, dowhile Coins 6

7 if, switch, for, while, do-while 4. 3 Java HIRML Java HIRML j2hirml CASE Japid [11] Japid Java Sapid SDB Sapid AR SDB j2hirml Java SDB HIRML j2hirml Java 1500 HIRML Java 1. try catch Java j2hirml HIRML HIRML HIRML HIRML C Java HIRML C HIRML Java HIRML C Coins Java Java Coins C Coins Java Java JavaScript JSP Web HIRML Coins [1] Weiser, M. Program Slicing, IEEE Transactions on Software Engineering, Vol.10, No.4, pp , 1984 [2] World Wide Web Consortium (W3C) Extensible Markup Language (XML) 1.0 (Second Edition), http// [3] WWW Consortium (W3C) XSL Transformations (XSLT) Version 1.0, http// [4] WWW Consortium (W3C) Document Object Model, http// [5] Coins, http// [6],, CASE Sapid,, Vol.39, No.6, pp , 1998 [7] S.Horwitz and T.Reps The use of program dependence graphs in software engineering, Proc.14th International Conference on Software Engineering, pp , Melbourne, Australia, 1992 [8] The Wisconsin Program-Slicing Tool, http// tool/ [9] J. R. Lyle and D. R. Wallace Using the unravel program slicing tool to evaluate high integrity software, In Proceedings of 10th International Software Quality Week, USA, May 1997 [10] The Unravel Program Slicing Tool, http//hissa.nist.gov/unravel/ [11] Y. Hachisu, S. Yamamoto and K. Agusa A CASE Tool Platform for Object Oriented Language, IEICE Trans. on Information and Systems, Vol.E82-D, No.5, pp , 1999 [12] 1995 [13]

Dependence Graph Considerering Resource for Automatic Sample Program Generation

Dependence Graph Considerering Resource for Automatic Sample Program Generation 1 2 2 2 ( ) Google Android Dependence Graph Considerering Resource for Automatic Sample Program Generation Yoshimasa Fujiura, 1 Hirotaka Ohkubo, 1 Hideto Kasuya 1 and Shinichiro Yamamoto 1 This paper propose

More information

Static Single Assignment Form in the COINS Compiler Infrastructure Current Status and Background

Static Single Assignment Form in the COINS Compiler Infrastructure Current Status and Background Static Single Assignment Form in the COINS Compiler Infrastructure Current Status and Background Masataka Sassa, Toshiharu Nakaya, Masaki Kohama, Takeaki Fukuoka, Masahito Takahashi and Ikuo Nakata Department

More information

LECTURE 3. Compiler Phases

LECTURE 3. Compiler Phases LECTURE 3 Compiler Phases COMPILER PHASES Compilation of a program proceeds through a fixed series of phases. Each phase uses an (intermediate) form of the program produced by an earlier phase. Subsequent

More information

Principles of Compiler Design

Principles of Compiler Design Principles of Compiler Design Intermediate Representation Compiler Lexical Analysis Syntax Analysis Semantic Analysis Source Program Token stream Abstract Syntax tree Unambiguous Program representation

More information

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan

Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah. Lecturer Department of Computer Science & IT University of Balochistan Programming Fundamentals (CS 302 ) Dr. Ihsan Ullah Lecturer Department of Computer Science & IT University of Balochistan 1 Outline p Introduction p Program development p C language and beginning with

More information

Basic Types, Variables, Literals, Constants

Basic Types, Variables, Literals, Constants Basic Types, Variables, Literals, Constants What is in a Word? A byte is the basic addressable unit of memory in RAM Typically it is 8 bits (octet) But some machines had 7, or 9, or... A word is the basic

More information

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

G Programming Languages Spring 2010 Lecture 6. Robert Grimm, New York University G22.2110-001 Programming Languages Spring 2010 Lecture 6 Robert Grimm, New York University 1 Review Last week Function Languages Lambda Calculus SCHEME review 2 Outline Promises, promises, promises Types,

More information

Programming in C++ 4. The lexical basis of C++

Programming in C++ 4. The lexical basis of C++ Programming in C++ 4. The lexical basis of C++! Characters and tokens! Permissible characters! Comments & white spaces! Identifiers! Keywords! Constants! Operators! Summary 1 Characters and tokens A C++

More information

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING

STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING OBJECT ORIENTED PROGRAMMING STUDY NOTES UNIT 1 - INTRODUCTION TO OBJECT ORIENTED PROGRAMMING 1. Object Oriented Programming Paradigms 2. Comparison of Programming Paradigms 3. Basic Object Oriented Programming

More information

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14

Variables Data types Variable I/O. C introduction. Variables. Variables 1 / 14 C introduction Variables Variables 1 / 14 Contents Variables Data types Variable I/O Variables 2 / 14 Usage Declaration: t y p e i d e n t i f i e r ; Assignment: i d e n t i f i e r = v a l u e ; Definition

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

Scripting languages. shell programs are good for personal tools

Scripting languages. shell programs are good for personal tools Scripting languages shell programs are good for personal tools tailoring environment abbreviating common operations (aliases do the same) gluing together existing programs into new ones prototyping sometimes

More information

Concepts Introduced in Chapter 6

Concepts Introduced in Chapter 6 Concepts Introduced in Chapter 6 types of intermediate code representations translation of declarations arithmetic expressions boolean expressions flow-of-control statements backpatching EECS 665 Compiler

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

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

Laboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information

Laboratory 2: Programming Basics and Variables. Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information Laboratory 2: Programming Basics and Variables Lecture notes: 1. A quick review of hello_comment.c 2. Some useful information 3. Comment: a. name your program with extension.c b. use o option to specify

More information

Intermediate Representation (IR)

Intermediate Representation (IR) Intermediate Representation (IR) Components and Design Goals for an IR IR encodes all knowledge the compiler has derived about source program. Simple compiler structure source code More typical compiler

More information

516. XSLT. Prerequisites. Version 1.2

516. XSLT. Prerequisites. Version 1.2 516. XSLT Version 1.2 This comprehensive four-day course develops in-depth knowledge and skills in transforming XML documents using extensible Stylesheet Language Transformations, or XSLT. Students work

More information

Implementing Subprograms

Implementing Subprograms 1 Implementing Subprograms CS 315 Programming Languages Pinar Duygulu Bilkent University CS315 Programming Languages Pinar Duygulu The General Semantics of Calls and Returns 2 The subprogram call and return

More information

Scripting languages. shell programs are good for personal tools

Scripting languages. shell programs are good for personal tools Scripting languages shell programs are good for personal tools tailoring environment abbreviating common operations (aliases do the same) gluing together existing programs into new ones prototyping sometimes

More information

Data Types. Data Types. Introduction. Data Types. Data Types. Data Types. Introduction

Data Types. Data Types. Introduction. Data Types. Data Types. Data Types. Introduction Introduction Primitive Composite Structured Abstract Introduction Introduction Data Type is a Collection of Data Objects Possible r-values for a memory cell Set of operations on those objects Descriptor

More information

C: How to Program. Week /Mar/05

C: How to Program. Week /Mar/05 1 C: How to Program Week 2 2007/Mar/05 Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers

More information

Program Obfuscation Scheme Using Random Numbers to Complicate Control Flow

Program Obfuscation Scheme Using Random Numbers to Complicate Control Flow Program Obfuscation Scheme Using Random Numbers to Complicate Control Flow Tatsuya Toyofuku 1, Toshihiro Tabata 2, and Kouichi Sakurai 3 1 Graduate School of Information Science and Electrical Engineering,

More information

Intermediate Code Generation

Intermediate Code Generation Intermediate Code Generation In the analysis-synthesis model of a compiler, the front end analyzes a source program and creates an intermediate representation, from which the back end generates target

More information

Compiling and Interpreting Programming. Overview of Compilers and Interpreters

Compiling and Interpreting Programming. Overview of Compilers and Interpreters Copyright R.A. van Engelen, FSU Department of Computer Science, 2000 Overview of Compilers and Interpreters Common compiler and interpreter configurations Virtual machines Integrated programming environments

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

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

Concepts Introduced in Chapter 6

Concepts Introduced in Chapter 6 Concepts Introduced in Chapter 6 types of intermediate code representations translation of declarations arithmetic expressions boolean expressions flow-of-control statements backpatching EECS 665 Compiler

More information

SymtabAPI Programmer s Guide

SymtabAPI Programmer s Guide Paradyn Parallel Performance Tools SymtabAPI Programmer s Guide 9.1 Release Dec 2015 Computer Sciences Department University of Wisconsin Madison Madison, WI 53706 Computer Science Department University

More information

BLM2031 Structured Programming. Zeyneb KURT

BLM2031 Structured Programming. Zeyneb KURT BLM2031 Structured Programming Zeyneb KURT 1 Contact Contact info office : D-219 e-mail zeynebkurt@gmail.com, zeyneb@ce.yildiz.edu.tr When to contact e-mail first, take an appointment What to expect help

More information

What is a compiler? var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done

What is a compiler? var a var b mov 3 a mov 4 r1 cmpi a r1 jge l_e mov 2 b jmp l_d l_e: mov 3 b l_d: ;done What is a compiler? What is a compiler? Traditionally: Program that analyzes and translates from a high level language (e.g., C++) to low-level assembly language that can be executed by hardware int a,

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

Programming Languages: Lecture 12

Programming Languages: Lecture 12 1 Programming Languages: Lecture 12 Chapter 10: Implementing Subprograms Jinwoo Kim jwkim@jjay.cuny.edu Chapter 10 Topics 2 The General Semantics of Calls and Returns Implementing Simple Subprograms Implementing

More information

Type checking of statements We change the start rule from P D ; E to P D ; S and add the following rules for statements: S id := E

Type checking of statements We change the start rule from P D ; E to P D ; S and add the following rules for statements: S id := E Type checking of statements We change the start rule from P D ; E to P D ; S and add the following rules for statements: S id := E if E then S while E do S S ; S Type checking of statements The purpose

More information

A Virtual File System for Source Program Editing

A Virtual File System for Source Program Editing A Virtual File System for Source Program Editing Yoshida Atsushi Center for Information Science Wakayama University 930 Sakaedani, Wakayama, Japan atsu@center.wakayama-u.ac.jp Fukuyasu Naoki Faculty of

More information

Computational Physics Operating systems

Computational Physics Operating systems Computational Physics numerical methods with C++ (and UNIX) 2018-19 Fernando Barao Instituto Superior Tecnico, Dep. Fisica email: fernando.barao@tecnico.ulisboa.pt Computational Physics 2018-19 (Phys Dep

More information

Delivery Options: Attend face-to-face in the classroom or via remote-live attendance.

Delivery Options: Attend face-to-face in the classroom or via remote-live attendance. XML Programming Duration: 5 Days US Price: $2795 UK Price: 1,995 *Prices are subject to VAT CA Price: CDN$3,275 *Prices are subject to GST/HST Delivery Options: Attend face-to-face in the classroom or

More information

CS321 Languages and Compiler Design I. Winter 2012 Lecture 1

CS321 Languages and Compiler Design I. Winter 2012 Lecture 1 CS321 Languages and Compiler Design I Winter 2012 Lecture 1 1 COURSE GOALS Improve understanding of languages and machines. Learn practicalities of translation. Learn anatomy of programming languages.

More information

C Language, Token, Keywords, Constant, variable

C Language, Token, Keywords, Constant, variable C Language, Token, Keywords, Constant, variable A language written by Brian Kernighan and Dennis Ritchie. This was to be the language that UNIX was written in to become the first "portable" language. C

More information

CprE 288 Introduction to Embedded Systems Exam 1 Review. 1

CprE 288 Introduction to Embedded Systems Exam 1 Review.  1 CprE 288 Introduction to Embedded Systems Exam 1 Review http://class.ece.iastate.edu/cpre288 1 Overview of Today s Lecture Announcements Exam 1 Review http://class.ece.iastate.edu/cpre288 2 Announcements

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

What is a compiler? Xiaokang Qiu Purdue University. August 21, 2017 ECE 573

What is a compiler? Xiaokang Qiu Purdue University. August 21, 2017 ECE 573 What is a compiler? Xiaokang Qiu Purdue University ECE 573 August 21, 2017 What is a compiler? What is a compiler? Traditionally: Program that analyzes and translates from a high level language (e.g.,

More information

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher

COP4020 Programming Languages. Compilers and Interpreters Robert van Engelen & Chris Lacher COP4020 ming Languages Compilers and Interpreters Robert van Engelen & Chris Lacher Overview Common compiler and interpreter configurations Virtual machines Integrated development environments Compiler

More information

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design

General Concepts. Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design General Concepts Abstraction Computational Paradigms Implementation Application Domains Influence on Success Influences on Design 1 Abstractions in Programming Languages Abstractions hide details that

More information

A Fast Review of C Essentials Part I

A Fast Review of C Essentials Part I A Fast Review of C Essentials Part I Structural Programming by Z. Cihan TAYSI Outline Program development C Essentials Functions Variables & constants Names Formatting Comments Preprocessor Data types

More information

Delivery Options: Attend face-to-face in the classroom or remote-live attendance.

Delivery Options: Attend face-to-face in the classroom or remote-live attendance. XML Programming Duration: 5 Days Price: $2795 *California residents and government employees call for pricing. Discounts: We offer multiple discount options. Click here for more info. Delivery Options:

More information

Tokens, Expressions and Control Structures

Tokens, Expressions and Control Structures 3 Tokens, Expressions and Control Structures Tokens Keywords Identifiers Data types User-defined types Derived types Symbolic constants Declaration of variables Initialization Reference variables Type

More information

Programming Languages

Programming Languages Programming Languages Types CSCI-GA.2110-001 Summer 2011 What is a type? A type consists of a set of values The compiler/interpreter defines a mapping of these values onto the underlying hardware. 2 /

More information

Project 2 Interpreter for Snail. 2 The Snail Programming Language

Project 2 Interpreter for Snail. 2 The Snail Programming Language CSCI 2400 Models of Computation Project 2 Interpreter for Snail 1 Overview In this assignment you will use the parser generator yacc to construct an interpreter for a language called Snail containing the

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

Syntax. A. Bellaachia Page: 1

Syntax. A. Bellaachia Page: 1 Syntax 1. Objectives & Definitions... 2 2. Definitions... 3 3. Lexical Rules... 4 4. BNF: Formal Syntactic rules... 6 5. Syntax Diagrams... 9 6. EBNF: Extended BNF... 10 7. Example:... 11 8. BNF Statement

More information

Compilation I. Hwansoo Han

Compilation I. Hwansoo Han Compilation I Hwansoo Han Language Groups Imperative von Neumann (Fortran, Pascal, Basic, C) Object-oriented (Smalltalk, Eiffel, C++) Scripting languages (Perl, Python, JavaScript, PHP) Declarative Functional

More information

FUNCTION POINTERS. int (*pf)(); // pf is a pointer to a function returning an int.

FUNCTION POINTERS. int (*pf)(); // pf is a pointer to a function returning an int. Function Pointers 1 FUNCTION POINTERS Sometimes we would like to choose different behaviors at different times in the same piece of code or function. For instance in a sorting routine, we want to allow

More information

More On Syntax Directed Translation

More On Syntax Directed Translation More On Syntax Directed Translation 1 Types of Attributes We have productions of the form: A X 1 X 2 X 3... X n with semantic rules of the form: b:= f(c 1, c 2, c 3,..., c n ) where b and the c s are attributes

More information

Design and Implementation of HTML5 based SVM for Integrating Runtime of Smart Devices and Web Environments

Design and Implementation of HTML5 based SVM for Integrating Runtime of Smart Devices and Web Environments Vol.8, No.3 (2014), pp.223-234 http://dx.doi.org/10.14257/ijsh.2014.8.3.21 Design and Implementation of HTML5 based SVM for Integrating Runtime of Smart Devices and Web Environments Yunsik Son 1, Seman

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

Where we are. What makes a good IR? Intermediate Code. CS 4120 Introduction to Compilers

Where we are. What makes a good IR? Intermediate Code. CS 4120 Introduction to Compilers Where we are CS 4120 Introduction to Compilers Andrew Myers Cornell University Lecture 13: Intermediate Code 25 Sep 09 Source code (character stream) Token stream Abstract syntax tree Abstract syntax tree

More information

Chapter 10. Implementing Subprograms ISBN

Chapter 10. Implementing Subprograms ISBN Chapter 10 Implementing Subprograms ISBN 0-321-33025-0 Chapter 10 Topics The General Semantics of Calls and Returns Implementing Simple Subprograms Implementing Subprograms with Stack-Dynamic Local Variables

More information

CSc 453. Compilers and Systems Software. 13 : Intermediate Code I. Department of Computer Science University of Arizona

CSc 453. Compilers and Systems Software. 13 : Intermediate Code I. Department of Computer Science University of Arizona CSc 453 Compilers and Systems Software 13 : Intermediate Code I Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2009 Christian Collberg Introduction Compiler Phases

More information

Qualifying Exam in Programming Languages and Compilers

Qualifying Exam in Programming Languages and Compilers Qualifying Exam in Programming Languages and Compilers University of Wisconsin Fall 1991 Instructions This exam contains nine questions, divided into two parts. All students taking the exam should answer

More information

Extracting Output Schemas from XSLT Stylesheets and Their Possible Applications

Extracting Output Schemas from XSLT Stylesheets and Their Possible Applications Extracting Output Schemas from XSLT Stylesheets and Their Possible Applications Ruben Mes ruben.mes@ist.utl.pt José Borbinha jlb@ist.utl.pt Hugo Manguinhas hugo.manguinhas@ist.utl.pt Abstract XML is nowadays

More information

Chapter 2 - Introduction to C Programming

Chapter 2 - Introduction to C Programming Chapter 2 - Introduction to C Programming 2 Outline 2.1 Introduction 2.2 A Simple C Program: Printing a Line of Text 2.3 Another Simple C Program: Adding Two Integers 2.4 Memory Concepts 2.5 Arithmetic

More information

Introduction to Esoteric Language Malbolge

Introduction to Esoteric Language Malbolge Introduction to Esoteric Language Malbolge Masahiko Sakai Graduate School of Information Science, Nagoya University, furo-cho Chikusa-ku, Nagoya 4648603 Japan 1 Introduction Improving readability, describability

More information

9/5/17. The Design and Implementation of Programming Languages. Compilation. Interpretation. Compilation vs. Interpretation. Hybrid Implementation

9/5/17. The Design and Implementation of Programming Languages. Compilation. Interpretation. Compilation vs. Interpretation. Hybrid Implementation Language Implementation Methods The Design and Implementation of Programming Languages Compilation Interpretation Hybrid In Text: Chapter 1 2 Compilation Interpretation Translate high-level programs to

More information

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above

P.G.TRB - COMPUTER SCIENCE. c) data processing language d) none of the above P.G.TRB - COMPUTER SCIENCE Total Marks : 50 Time : 30 Minutes 1. C was primarily developed as a a)systems programming language b) general purpose language c) data processing language d) none of the above

More information

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:

C Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites: C Programming Code: MBD101 Duration: 10 Hours Prerequisites: You are a computer science Professional/ graduate student You can execute Linux/UNIX commands You know how to use a text-editing tool You should

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

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 314 Principles of Programming Languages

CS 314 Principles of Programming Languages CS 314 Principles of Programming Languages Lecture 13: Names, Scopes and Bindings Zheng (Eddy) Zhang Rutgers University February 28, 2018 Review: Names, Scopes and Binding What s in a name? Each name means

More information

The Pivot framework: Design and Implementation

The Pivot framework: Design and Implementation The Pivot framework: Design and Implementation B. Stroustrup G. Dos Reis Department of Computer Science Texas A&M University Argone, 2004-08-18 p. 1 The Problem The original problem (inspiration) Poor

More information

EC 413 Computer Organization

EC 413 Computer Organization EC 413 Computer Organization C/C++ Language Review Prof. Michel A. Kinsy Programming Languages There are many programming languages available: Pascal, C, C++, Java, Ada, Perl and Python All of these languages

More information

4. INFORMATION SCIENCE AND ENGINEERING

4. INFORMATION SCIENCE AND ENGINEERING 4. INFORMATION SCIENCE AND ENGINEERING 1. PURPOSE OF THE COURSE Refer to the each sub-course. *The each sub-course is related with the concept Advanced Information Technology Research. 2. TRAINING PROGRAM

More information

Programming. C++ Basics

Programming. C++ Basics Programming C++ Basics Introduction to C++ C is a programming language developed in the 1970s with the UNIX operating system C programs are efficient and portable across different hardware platforms C++

More information

AIM. 10 September

AIM. 10 September AIM These two courses are aimed at introducing you to the World of Web Programming. These courses does NOT make you Master all the skills of a Web Programmer. You must learn and work MORE in this area

More information

A Route Selection Scheme for Multi-Route Coding in Multihop Cellular Networks

A Route Selection Scheme for Multi-Route Coding in Multihop Cellular Networks A Route Selection Scheme for Multi-Route Coding in Multihop Cellular Networks Hiraku Okada,HitoshiImai, Takaya Yamazato, Masaaki Katayama, Kenichi Mase Center for Transdisciplinary Research, Niigata University,

More information

Static Single Assignment Form in the COINS Compiler Infrastructure

Static Single Assignment Form in the COINS Compiler Infrastructure Static Single Assignment Form in the COINS Compiler Infrastructure Masataka Sassa (Tokyo Institute of Technology) Background Static single assignment (SSA) form facilitates compiler optimizations. Compiler

More information

Outline. Introduction to Programming (in C++) Introduction. First program in C++ Programming examples

Outline. Introduction to Programming (in C++) Introduction. First program in C++ Programming examples Outline Introduction to Programming (in C++) Introduction Programming examples Algorithms, programming languages and computer programs Jordi Cortadella, Ricard Gavaldà, Fernando Orejas Dept. of Computer

More information

Working of the Compilers

Working of the Compilers Working of the Compilers Manisha Yadav Nisha Thakran IT DEPARTMENT IT DEPARTMENT DCE,GURGAON DCE,GURGAON Abstract- The objective of the paper is to depict the working of the compilers that were designed

More information

Web. 2 Web. A Data Dependency Graph for Web Applications. Web Web Web. Web. Web. Java. Web. Web HTTP. Web

Web. 2 Web. A Data Dependency Graph for Web Applications. Web Web Web. Web. Web. Java. Web. Web HTTP. Web Web A Data Dependency Graph for Web Applications Summary. In this paper, we propose a data dependency graph for web applications. Since web applications consist of many components, data are delivered among

More information

Recap. ANSI C Reserved Words C++ Multimedia Programming Lecture 2. Erwin M. Bakker Joachim Rijsdam

Recap. ANSI C Reserved Words C++ Multimedia Programming Lecture 2. Erwin M. Bakker Joachim Rijsdam Multimedia Programming 2004 Lecture 2 Erwin M. Bakker Joachim Rijsdam Recap Learning C++ by example No groups: everybody should experience developing and programming in C++! Assignments will determine

More information

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable

Basic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable Basic C++ Overview C++ is a version of the older C programming language. This is a language that is used for a wide variety of applications and which has a mature base of compilers and libraries. C++ is

More information

The Mercury project. Zoltan Somogyi

The Mercury project. Zoltan Somogyi The Mercury project Zoltan Somogyi The University of Melbourne Linux Users Victoria 7 June 2011 Zoltan Somogyi (Linux Users Victoria) The Mercury project June 15, 2011 1 / 23 Introduction Mercury: objectives

More information

[6 marks] All parts of this question assume the following C statement. Parts (b) through (e) assume a variable called ptrs.

[6 marks] All parts of this question assume the following C statement. Parts (b) through (e) assume a variable called ptrs. Question 1. All parts of this question assume the following C statement. Parts (b) through (e) assume a variable called ptrs. char data[256] = "Hop Pop We like to hop."; Part (a) Is the following statement

More information

DECLARATIONS. Character Set, Keywords, Identifiers, Constants, Variables. Designed by Parul Khurana, LIECA.

DECLARATIONS. Character Set, Keywords, Identifiers, Constants, Variables. Designed by Parul Khurana, LIECA. DECLARATIONS Character Set, Keywords, Identifiers, Constants, Variables Character Set C uses the uppercase letters A to Z. C uses the lowercase letters a to z. C uses digits 0 to 9. C uses certain Special

More information

TYPES, VALUES AND DECLARATIONS

TYPES, VALUES AND DECLARATIONS COSC 2P90 TYPES, VALUES AND DECLARATIONS (c) S. Thompson, M. Winters 1 Names, References, Values & Types data items have a value and a type type determines set of operations variables Have an identifier

More information

ET156 Introduction to C Programming

ET156 Introduction to C Programming ET156 Introduction to C Programming Unit 1 INTRODUCTION TO C PROGRAMMING: THE C COMPILER, VARIABLES, MEMORY, INPUT, AND OUTPUT Instructor : Stan Kong Email : skong@itt tech.edutech.edu Figure 1.3 Components

More information

Compiler Construction

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

More information

Infrastructure for Multilayer Interoperability to Encourage Use of Heterogeneous Data and Information Sharing between Government Systems

Infrastructure for Multilayer Interoperability to Encourage Use of Heterogeneous Data and Information Sharing between Government Systems Hitachi Review Vol. 65 (2016), No. 1 729 Featured Articles Infrastructure for Multilayer Interoperability to Encourage Use of Heterogeneous Data and Information Sharing between Government Systems Kazuki

More information

Over-simplified history of programming languages

Over-simplified history of programming languages Lecture 3 AWK Over-simplified history of programming languages 1940's 1950's 1960's machine language assembly language high-level languages: Algol, Fortran, Cobol, Basic 1970's 1980's 1990's systems programming:

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

2/29/2016. Definition: Computer Program. A simple model of the computer. Example: Computer Program. Data types, variables, constants

2/29/2016. Definition: Computer Program. A simple model of the computer. Example: Computer Program. Data types, variables, constants Data types, variables, constants Outline.1 Introduction. Text.3 Memory Concepts.4 Naming Convention of Variables.5 Arithmetic in C.6 Type Conversion Definition: Computer Program A Computer program is a

More information

Application Specific Signal Processors S

Application Specific Signal Processors S 1 Application Specific Signal Processors 521281S Dept. of Computer Science and Engineering Mehdi Safarpour 23.9.2018 Course contents Lecture contents 1. Introduction and number formats 2. Signal processor

More information

A tutorial report for SENG Agent Based Software Engineering. Course Instructor: Dr. Behrouz H. Far. XML Tutorial.

A tutorial report for SENG Agent Based Software Engineering. Course Instructor: Dr. Behrouz H. Far. XML Tutorial. A tutorial report for SENG 609.22 Agent Based Software Engineering Course Instructor: Dr. Behrouz H. Far XML Tutorial Yanan Zhang Department of Electrical and Computer Engineering University of Calgary

More information

Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p.

Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p. Preface p. xiii Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p. 5 Client-Side JavaScript: Executable Content

More information

Inf 202 Introduction to Data and Databases (Spring 2010)

Inf 202 Introduction to Data and Databases (Spring 2010) Inf 202 Introduction to Data and Databases (Spring 2010) Jagdish S. Gangolly Informatics CCI SUNY Albany April 22, 2010 Database Processing Applications Standard Database Processing Client/Server Environment

More information

Final CSE 131B Spring 2004

Final CSE 131B Spring 2004 Login name Signature Name Student ID Final CSE 131B Spring 2004 Page 1 Page 2 Page 3 Page 4 Page 5 Page 6 Page 7 Page 8 (25 points) (24 points) (32 points) (24 points) (28 points) (26 points) (22 points)

More information

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan

Introduction to C Programming. Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Introduction to C Programming Chih-Wei Tang ( 唐之瑋 ) Department of Communication Engineering National Central University JhongLi, Taiwan Outline Printing texts Adding 2 integers Comparing 2 integers C.E.,

More information

6.096 Introduction to C++ January (IAP) 2009

6.096 Introduction to C++ January (IAP) 2009 MIT OpenCourseWare http://ocw.mit.edu 6.096 Introduction to C++ January (IAP) 2009 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Welcome to 6.096 Lecture

More information

LLVM IR Code Generations Inside YACC. Li-Wei Kuo

LLVM IR Code Generations Inside YACC. Li-Wei Kuo LLVM IR Code Generations Inside YACC Li-Wei Kuo LLVM IR LLVM code representation In memory compiler IR (Intermediate Representation) On-disk bitcode representation (*.bc) Human readable assembly language

More information

COSC121: Computer Systems: Runtime Stack

COSC121: Computer Systems: Runtime Stack COSC121: Computer Systems: Runtime Stack Jeremy Bolton, PhD Assistant Teaching Professor Constructed using materials: - Patt and Patel Introduction to Computing Systems (2nd) - Patterson and Hennessy Computer

More information