# And Parallelism. Parallelism in Prolog. OR Parallelism

Save this PDF as:

Size: px
Start display at page:

Download "And Parallelism. Parallelism in Prolog. OR Parallelism"

## Transcription

1 Parallelism in Prolog And Parallelism One reason that Prolog is of interest to computer scientists is that its search mechanism lends itself to parallel evaluation. In fact, it supports two different kinds of parallelism: AND Parallelism OR Parallelism When we have a goal that contains subgoals connected by the, (And) operator, we may be able to utilize and parallelism. Rather than solve subgoals in sequence, we may be able to solve them in parallel if bindings can be properly propagated. Thus in a(x), b(x,y), c(x,z), d(y,z). we may be able to first solve a(x), binding X, then solve b(x,y) and c(x,z) in parallel, binding Y and Z, then finally solve d(y,z) An example of this sort of and parallelism is member(x,list1), member1(x,list2), isprime(x). Here we can let member(x,list1) select an X value, then test member1(x,list2) and isprime(x) in parallel. If one or the other fails, we just select another X from list1 and retest member1(x,list2) and isprime(x) in parallel. OR Parallelism When we match a goal we almost always have a choice of several rules or facts that may be applicable. Rather than try them in sequence, we can try several matches of different facts or rules in parallel. This is or parallelism. Thus given a(x) :- b(x). a(y) :- c(y). when we try to solve a(10). we can simultaneously check both b(10) and c(10)

2 Recall our definition of member(x,l) :- append(p,[x S],L). where append is defined as append([],l,l). append([x L1],L2,[X L3]) :- append(l1,l2,l3). Assume we have the query? member(2,[1,2,3]). This immediately simplifies to append(p,[2 S],[1,2,3]). Now there are two append definitions we can try in parallel: (1) match append(p,[2 S],[1,2,3]) with append([],l,l). This requires that [2 S] = [1,2,3], which must fail. (2) match append(p,[2 S],[1,2,3]) with append([x L1],L2,[X,L3]). This requires that P=[X L1], [2 S]=L2, [1,2,3]=[X,L3]. Simplifying, we require that X=1, P=[1 L1], L3=[2,3]. Moreover we must solve append(l1,l2,l3) which simplifies to append(l1,[2 S],[2,3]). We can match this call to append in two different ways, so or parallelism can be used again. When we try matching append(l1,[2 S],[2,3]) against append([],l,l) we get [2 S]=[2,3], which is satisfiable if S is bound to [3]. We therefore signal back that the query is true Speculative Parallelism Prolog also lends itself nicely to speculative parallelism. In this form of parallelism, we guess or speculate that some computation may be needed in the future and start it early. This speculative computation can often be done in parallel with the main (nonspeculative) computation. Recall our example of member(x,list1), member1(x,list2), isprime(x). After member(x,list1) has generated a preliminary solution for X, it is tested (perhaps in parallel) by member1(x,list2) and isprime(x). But this value of X may be rejected by one or both of these tests. If it is, we ll ask member(x,list1) to find a new binding for X. If we wish, this next binding can be generated speculatively, while the current value of X is being tested. In this way if the current value of X is rejected, we ll have a new value ready to try (or know that no other binding of X is possible). If the current value of X is accepted, the extra speculative work we did is ignored. It wasn t needed, but was useful insurance in case further X bindings were needed

3 Reading Assignment Python Python Tutorial (linked from class web page) A modern and innovative scripting languages is Python, developed by Guido van Rossum in the mid-90s. Python is named after the BBC Monty Python television series. Python blends the expressive power and flexibility of earlier scripting languages with the power of object-oriented programming languages. It offers a lot to programmers: An interactive development mode as well as an executable batch mode for completed programs. Very reasonable execution speed. Like Java, Python programs are compiled. Also like Java, the compiled code is in an intermediate language for which an interpreter is written. Like Java this insulates Python from many of the vagaries of the actual machines on which it runs, giving it portability of an equivalent level to that of Java. Unlike Java, Python retains the interactivity for which interpreters are highly prized. Python programs require no compilation or linking. Nevertheless, the semi-compiled Python program still runs much faster than its traditionally interpreted rivals such as the shells, awk and perl. Python is freely available on almost all platforms and operating systems (Unix, Linux, Windows, MacOs, etc.) Python is completely object oriented. It comes with a full set of objected oriented features. Python presents a first class object model with first class functions and multiple inheritance. Also included are classes, modules, exceptions and late (run-time) binding. Python allows a clean and open program layout. Python code is less cluttered with the syntactic noise of declarations and scope definitions. Scope in a Python program is defined by the indentation of the code in question. Python thus breaks with current language designs in that white space has now once again acquired significance

4 Like Java, Python offers automated memory management through runtime reference counting and garbage collection of unreferenced objects. Python can be embedded in other products and programs as a control language. Python s interface is well exposed and is reasonably small and simple. Python s license is truly public. Python programs can be used or sold without copyright restrictions. Python is extendable. You can dynamically load compiled Python, Python source, or even dynamically load new machine (object) code to provide new features and new facilities. Python allows low-level access to its interpreter. It exposes its internal plumbing to a significant degree to allow programs to make use of the way the plumbing works. Python has a rich set of external library services available. This includes, network services, a GUI API (based on tcl/tk), Web support for the generation of HTML and the CGI interfaces, direct access to databases, etc Using Python Python may be used in either interactive or batch mode. In interactive mode you start up the Python interpreter and enter executable statements. Just naming a variable (a trivial expression) evaluates it and echoes its value. For example (>>> is the Python interactive prompt): >>> 1 1 >>> a=1 >>> a 1 >>> b=2.5 >>> b 2.5 >>> a+b 3.5 +b 3.5 You can also incorporate Python statements into a file and execute them in batch mode. One way to do this is to enter the command python file.py where file.py contains the Python code you want executed. Be careful though; in batch mode you must use a print (or some other output statement) to force output to be printed. Thus 1 a=1 a b=

5 b a+b print a+b when run in batch mode prints only 3.5 (the output of the print statement). You can also run Python programs as Unix shell scripts by adding the line #! /usr/bin/env python to the head of your Python file. (Since # begins Python comments, you can also feed the same augmented file directly to the Python interpreter) Python Command Format In Python, individual primitive commands and expressions must appear on a single line. This means that a = 1 +b does not assign 1+b to a! Rather, it assigns 1 to a, then evaluates +b. If you wish to span more than one line, you must use \ to escape the line: a = 1 \ +b is equivalent to a = 1 +b Compound statements, like if statements and while loops, can span multiple lines, but individual statements within an if or while (if they are primitive) must appear one a single line. Why this restriction? With it, ; s are mostly unnecessary! A ; at the end of a statement is legal but usually unnecessary, as the end-of-line forces the statement to end. You can use a ; to squeeze more than one statement onto a line, if you wish: a=1; b=2 ; c=3 Identifiers and Reserved Words Identifiers look much the same as in most programming languages. They are composed of letters, digits and underscores. Identifiers must begin with a letter or underscore. Case is significant. As in C and C++, identifiers that begin with an underscore often have special meaning. Python contains a fairly typical set of reserved words: and del for is raise assert elif from lambda return break else global not try class except if or while continue exec import pass def finally in print

6 Numeric Types There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals: Long integers, of unlimited precision. An integer literal followed by an l or L is a long integer literal: L 3. Floating point values, represented as a 64 bit floating point number. Literals are of fixed decimal or exponential form: e Complex numbers, represented as a pair of floating point numbers. In complex literals j or J is used to denote the imaginary part of the complex value: j -22.1j 10e10J+20.0 There is no character type. A literal like 'a' or "c" denotes a string of length one. There is no boolean type. A zero numeric value (any form), or None (the equivalent of void) or an empty string, list, tuple or dictionary is treated as false; other values are treated as true. Hence "abc" and "def" is treated as true in an if, since both strings are non-empty Arithmetic Operators Op Description ** Exponentiation + Unary plus - Unary minus ~ Bit-wise complement (int or long only) * Multiplication / Division % Remainder + Binary plus - Binary minus << Bit-wise left shift (int or long only) >> Bit-wise right shift (int or long only) & Bit-wise and (int or long only) Bit-wise or (int or long only) ^ Bit-wise Xor (int or long only) < Less than > Greater than >= Greater than or equal <= Less than or equal == Equal!= Not equal and Boolean and or Boolean or not Boolean not

7 Operator Precedence Levels Arithmetic Operator Use Listed from lowest to highest: or Boolean OR and Boolean AND not Boolean NOT <, <=, >, >=, <>,!=, == Comparisons Bitwise OR ^ Bitwise XOR & Bitwise AND <<, >> Shifts +, - Addition and subtraction *, /, % Multiplication, division, remainder ** Exponentiation +, - Positive, negative (unary) ~ Bitwise not Arithmetic operators may be used with any arithmetic type, with conversions automatically applied. Bit-wise operations are restricted to integers and long integers. The result type is determined by the generality of the operands. (Long is more general than int, float is more general than both int and long, complex is the most general numeric type). Thus >>> >>> 1+111L 112L >>> >>> 1+2.0j (1+2j) Unlike almost all other programming languages, relational operators may be chained (as in standard mathematics). Therefore a > b > c means (a > b) and (b > c) Assignment Statements In Python assignment is a statement not an expression. Thus a+(b=2) is illegal. Chained assignments are allowed: a = b = 3 Since Python is dynamically typed, the type (and value) associated with an identifier can change because of an assignment: >>> a = 0 0 >>> a = a + 0L

8 0L >>> a = a >>> a = a + 0.0J 0j If and While Statements Python contains if and while statements that are fairly similar to those found in C and Java. There are some significant differences though. A line that contains an if, else or while ends in a :. Thus we might write: if a > 0: b = 1 Moreover the indentation of the then part is significant! You don t need { and } in Python because all statements indented at the same level are assumed to be part of the same block In the following Python statements if a>0: b=1 c=2 d=3 the assignments to b and c constitute then part; the assignment to d follows the if statement, and is independent of it. In interactive mode a blank line is needed to allow the interpreter to determine where the if statement ends; this blank line is not needed in batch mode. The if Statement The full form of the if statement is if expression: statement(s) elif expression: statement(s)... else: statement(s) Note those pesky : s at the end of the if, elif and else lines. The expressions following the if and optional elif lines are evaluated until one evaluates to true. Then the following statement(s), delimited by indentation, are executed. If no expression evaluates to true, the statements following the else are executed

9 Use of else and elif are optional; a bare if may be used. If any of the lists of statements is to be null, use pass to indicate that nothing is to be done. For example if a>0: b=1 elif a < 0: pass else: b=0 This if sets b to 1 if a is > 0; it sets b to 0 if a==0, and does nothing if a < 0. While Loops Python contains a fairly conventional while loop: while expression: body Note the : that ends the header line. Also, indentation delimits the body of the loop; no braces are needed. For example, >>> a=0; b=0 >>> while a < 5:... b = b+a**2... a= a+1...,b Break, Continue and Else in Loops Like C, C++ and Java, Python allows use of break within a loop to force loop termination. For example, >>> a=1 >>> while a < 10:... if a+a == a**2:... break... else:... a=a A continue may be used to force the next loop iteration: >>> a=1 >>> while a < 100:... a=a+1... if a%2==0:... continue... a=3*a

10 Python also allows you to add an else clause to a while (or for) loop. The syntax is while expression: body else: statement(s) The else statements are executed when the termination condition becomes false, but not when the loop is terminated with a break. As a result, you can readily program search loops that need to handle the special case of search failure: >>> a=1 >>> while a < 1000:... if a**2 == 3*a-1:... print "winner: ",a... break... a=a+1... else:... print "No match"... No match

Table of Contents Introduction... 1-2 A Brief History of Python... 1-3 Python Versions... 1-4 Installing Python... 1-5 Environment Variables... 1-6 Executing Python from the Command Line... 1-7 IDLE...

### The current topic: Python. Announcements. Python. Python

The current topic: Python Announcements! Introduction! reasons for studying languages! language classifications! simple syntax specification Object-oriented programming: Python Types and values Syntax

### Key Differences Between Python and Java

Python Python supports many (but not all) aspects of object-oriented programming; but it is possible to write a Python program without making any use of OO concepts. Python is designed to be used interpretively.

### Babu Madhav Institute of Information Technology, UTU 2015

Five years Integrated M.Sc.(IT)(Semester 5) Question Bank 060010502:Programming in Python Unit-1:Introduction To Python Q-1 Answer the following Questions in short. 1. Which operator is used for slicing?

### Chapter 3: Operators, Expressions and Type Conversion

101 Chapter 3 Operators, Expressions and Type Conversion Chapter 3: Operators, Expressions and Type Conversion Objectives To use basic arithmetic operators. To use increment and decrement operators. To

### The Arithmetic Operators. Unary Operators. Relational Operators. Examples of use of ++ and

The Arithmetic Operators The arithmetic operators refer to the standard mathematical operators: addition, subtraction, multiplication, division and modulus. Op. Use Description + x + y adds x and y x y

### Introduction. Following are the types of operators: Unary requires a single operand Binary requires two operands Ternary requires three operands

Introduction Operators are the symbols which operates on value or a variable. It tells the compiler to perform certain mathematical or logical manipulations. Can be of following categories: Unary requires

### Variable and Data Type I

Islamic University Of Gaza Faculty of Engineering Computer Engineering Department Lab 2 Variable and Data Type I Eng. Ibraheem Lubbad September 24, 2016 Variable is reserved a location in memory to store

### Sir Muhammad Naveed. Arslan Ahmed Shaad ( ) Muhammad Bilal ( )

Sir Muhammad Naveed Arslan Ahmed Shaad (1163135 ) Muhammad Bilal ( 1163122 ) www.techo786.wordpress.com CHAPTER: 2 NOTES:- VARIABLES AND OPERATORS The given Questions can also be attempted as Long Questions.

### Lexical Considerations

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler

### Variable and Data Type I

The Islamic University of Gaza Faculty of Engineering Dept. of Computer Engineering Intro. To Computers (LNGG 1003) Lab 2 Variable and Data Type I Eng. Ibraheem Lubbad February 18, 2017 Variable is reserved

### ARG! Language Reference Manual

ARG! Language Reference Manual Ryan Eagan, Mike Goldin, River Keefer, Shivangi Saxena 1. Introduction ARG is a language to be used to make programming a less frustrating experience. It is similar to C

### JAVA Programming Fundamentals

Chapter 4 JAVA Programming Fundamentals By: Deepak Bhinde PGT Comp.Sc. JAVA character set Character set is a set of valid characters that a language can recognize. It may be any letter, digit or any symbol

### CSc 10200! Introduction to Computing. Lecture 2-3 Edgardo Molina Fall 2013 City College of New York

CSc 10200! Introduction to Computing Lecture 2-3 Edgardo Molina Fall 2013 City College of New York 1 C++ for Engineers and Scientists Third Edition Chapter 2 Problem Solving Using C++ 2 Objectives In this

### SECTION II: LANGUAGE BASICS

Chapter 5 SECTION II: LANGUAGE BASICS Operators Chapter 04: Basic Fundamentals demonstrated declaring and initializing variables. This chapter depicts how to do something with them, using operators. Operators

### Objects and Types. COMS W1007 Introduction to Computer Science. Christopher Conway 29 May 2003

Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 Java Programs A Java program contains at least one class definition. public class Hello { public static void

### A Java program contains at least one class definition.

Java Programs Identifiers Objects and Types COMS W1007 Introduction to Computer Science Christopher Conway 29 May 2003 A Java program contains at least one class definition. public class Hello { public

### Algorithms and Programming I. Lecture#12 Spring 2015

Algorithms and Programming I Lecture#12 Spring 2015 Think Python How to Think Like a Computer Scientist By :Allen Downey Installing Python Follow the instructions on installing Python and IDLE on your

### Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups:

Basic Operators Java provides a rich set of operators to manipulate variables. We can divide all the Java operators into the following groups: Arithmetic Operators Relational Operators Bitwise Operators

### Operators & Expressions

Operators & Expressions Operator An operator is a symbol used to indicate a specific operation on variables in a program. Example : symbol + is an add operator that adds two data items called operands.

### Lecture 2 Tao Wang 1

Lecture 2 Tao Wang 1 Objectives In this chapter, you will learn about: Modular programs Programming style Data types Arithmetic operations Variables and declaration statements Common programming errors

### L-System Fractal Generator: Language Reference Manual

L-System Fractal Generator: Language Reference Manual Michael Eng, Jervis Muindi, Timothy Sun Contents 1 Program Definition 3 2 Lexical Conventions 3 2.1 Comments...............................................

### GridLang: Grid Based Game Development Language Language Reference Manual. Programming Language and Translators - Spring 2017 Prof.

GridLang: Grid Based Game Development Language Language Reference Manual Programming Language and Translators - Spring 2017 Prof. Stephen Edwards Akshay Nagpal Dhruv Shekhawat Parth Panchmatia Sagar Damani

### Advanced Algorithms and Computational Models (module A)

Advanced Algorithms and Computational Models (module A) Giacomo Fiumara giacomo.fiumara@unime.it 2014-2015 1 / 34 Python's built-in classes A class is immutable if each object of that class has a xed value

### Arithmetic Operators. Portability: Printing Numbers

Arithmetic Operators Normal binary arithmetic operators: + - * / Modulus or remainder operator: % x%y is the remainder when x is divided by y well defined only when x > 0 and y > 0 Unary operators: - +

### Language Reference Manual simplicity

Language Reference Manual simplicity Course: COMS S4115 Professor: Dr. Stephen Edwards TA: Graham Gobieski Date: July 20, 2016 Group members Rui Gu rg2970 Adam Hadar anh2130 Zachary Moffitt znm2104 Suzanna

### PYTHON FOR KIDS A Pl ayfu l I ntrodu ctio n to Prog r am m i ng J a s o n R. B r i g g s

PYTHON FO R K I D S A P l ay f u l I n t r o d u c t i o n to P r o g r a m m i n g Jason R. Briggs Index Symbols and Numbers + (addition operator), 17 \ (backslash) to separate lines of code, 235 in strings,

### Assoc. Prof. Dr. Marenglen Biba. (C) 2010 Pearson Education, Inc. All rights reserved.

Assoc. Prof. Dr. Marenglen Biba (C) 2010 Pearson Education, Inc. All for repetition statement do while repetition statement switch multiple-selection statement break statement continue statement Logical

### Fundamentals of Programming

Fundamentals of Programming Lecture 3 - Constants, Variables, Data Types, And Operations Lecturer : Ebrahim Jahandar Borrowed from lecturer notes by Omid Jafarinezhad Outline C Program Data types Variables

### Getting Started with Python

Fundamentals of Programming (Python) Getting Started with Python Sina Sajadmanesh Sharif University of Technology Some slides have been adapted from Python Programming: An Introduction to Computer Science

### Contents. Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual

Jairo Pava COMS W4115 June 28, 2013 LEARN: Language Reference Manual Contents 1 Introduction...2 2 Lexical Conventions...2 3 Types...3 4 Syntax...3 5 Expressions...4 6 Declarations...8 7 Statements...9

### UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

### SMURF Language Reference Manual Serial MUsic Represented as Functions

SMURF Language Reference Manual Serial MUsic Represented as Functions Richard Townsend, Lianne Lairmore, Lindsay Neubauer, Van Bui, Kuangya Zhai {rt2515, lel2143, lan2135, vb2363, kz2219}@columbia.edu

### Lecture Set 2: Starting Java

Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables 0 This Course: Intro to Procedural

### (Not Quite) Minijava

(Not Quite) Minijava CMCS22620, Spring 2004 April 5, 2004 1 Syntax program mainclass classdecl mainclass class identifier { public static void main ( String [] identifier ) block } classdecl class identifier

### MATLIP: MATLAB-Like Language for Image Processing

COMS W4115: Programming Languages and Translators MATLIP: MATLAB-Like Language for Image Processing Language Reference Manual Pin-Chin Huang (ph2249@columbia.edu) Shariar Zaber Kazi (szk2103@columbia.edu)

### Lexical Structure (Chapter 3, JLS)

Lecture Notes CS 140 Winter 2006 Craig A. Rich Lexical Structure (Chapter 3, JLS) - A Java source code file is viewed as a string of unicode characters, including line separators. - A Java source code

### JME Language Reference Manual

JME Language Reference Manual 1 Introduction JME (pronounced jay+me) is a lightweight language that allows programmers to easily perform statistic computations on tabular data as part of data analysis.

### Lecture Set 2: Starting Java

Lecture Set 2: Starting Java 1. Java Concepts 2. Java Programming Basics 3. User output 4. Variables and types 5. Expressions 6. User input 7. Uninitialized Variables 0 This Course: Intro to Procedural

### Basic Syntax - First Program 1

Python Basic Syntax Basic Syntax - First Program 1 All python files will have extension.py put the following source code in a test.py file. print "Hello, Python!";#hello world program run this program

### Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur

Operators and Expressions in C & C++ Mahesh Jangid Assistant Professor Manipal University, Jaipur Operators and Expressions 8/24/2012 Dept of CS&E 2 Arithmetic operators Relational operators Logical operators

### CA4003 Compiler Construction Assignment Language Definition

CA4003 Compiler Construction Assignment Language Definition David Sinclair 2017-2018 1 Overview The language is not case sensitive. A nonterminal, X, is represented by enclosing it in angle brackets, e.g.

### Client-Side Web Technologies. JavaScript Part I

Client-Side Web Technologies JavaScript Part I JavaScript First appeared in 1996 in Netscape Navigator Main purpose was to handle input validation that was currently being done server-side Now a powerful

### CS313D: ADVANCED PROGRAMMING LANGUAGE

CS313D: ADVANCED PROGRAMMING LANGUAGE Computer Science department Lecture 2 : C# Language Basics Lecture Contents 2 The C# language First program Variables and constants Input/output Expressions and casting

### Sprite an animation manipulation language Language Reference Manual

Sprite an animation manipulation language Language Reference Manual Team Leader Dave Smith Team Members Dan Benamy John Morales Monica Ranadive Table of Contents A. Introduction...3 B. Lexical Conventions...3

### What Version Number to Install

A Python Primer This chapter provides a quick overview of the Python language. The goal in this chapter is not to teach you the Python language excellent books have been written on that subject, such as

### Variables, expressions and statements

Variables, expressions and statements 2.1. Values and data types A value is one of the fundamental things like a letter or a number that a program manipulates. The values we have seen so far are 2 (the

### Chapter 2: Special Characters. Parts of a C++ Program. Introduction to C++ Displays output on the computer screen

Chapter 2: Introduction to C++ 2.1 Parts of a C++ Program Copyright 2009 Pearson Education, Inc. Copyright 2009 Publishing Pearson as Pearson Education, Addison-Wesley Inc. Publishing as Pearson Addison-Wesley

### Java Language Basics: Introduction To Java, Basic Features, Java Virtual Machine Concepts, Primitive Data Type And Variables, Java Operators,

Java Language Basics: Introduction To Java, Basic Features, Java Virtual Machine Concepts, Primitive Data Type And Variables, Java Operators, Expressions, Statements and Arrays. Java technology is: A programming

### Control, Quick Overview. Selection. Selection 7/6/2017. Chapter 2. Control

Chapter 2 Control, Quick Overview Control Selection Selection Selection is how programs make choices, and it is the process of making choices that provides a lot of the power of computing 1 Python if statement

### CT 229 Java Syntax Continued

CT 229 Java Syntax Continued 29/09/2006 CT229 Lab Assignments One Week Extension for Lab Assignment 1. Due Date: Oct 8 th Before submission make sure that the name of each.java file matches the name given

### C Language Part 1 Digital Computer Concept and Practice Copyright 2012 by Jaejin Lee

C Language Part 1 (Minor modifications by the instructor) References C for Python Programmers, by Carl Burch, 2011. http://www.toves.org/books/cpy/ The C Programming Language. 2nd ed., Kernighan, Brian,

### Computer Components. Software{ User Programs. Operating System. Hardware

Computer Components Software{ User Programs Operating System Hardware What are Programs? Programs provide instructions for computers Similar to giving directions to a person who is trying to get from point

### Chapter 12 Variables and Operators

Chapter 12 Variables and Operators Highlights (1) r. height width operator area = 3.14 * r *r + width * height literal/constant variable expression (assignment) statement 12-2 Highlights (2) r. height

### C++ character set Letters:- A-Z, a-z Digits:- 0 to 9 Special Symbols:- space + - / ( ) [ ] =! = < >, \$ # ; :? & White Spaces:- Blank Space, Horizontal

TOKENS C++ character set Letters:- A-Z, a-z Digits:- 0 to 9 Special Symbols:- space + - / ( ) [ ] =! = < >, \$ # ; :? & White Spaces:- Blank Space, Horizontal Tab, Vertical tab, Carriage Return. Other Characters:-

### The Warhol Language Reference Manual

The Warhol Language Reference Manual Martina Atabong maa2247 Charvinia Neblett cdn2118 Samuel Nnodim son2105 Catherine Wes ciw2109 Sarina Xie sx2166 Introduction Warhol is a functional and imperative programming

### ASML Language Reference Manual

ASML Language Reference Manual Tim Favorite (tuf1) & Frank Smith (fas2114) - Team SoundHammer Columbia University COMS W4115 - Programming Languages & Translators 1. Introduction The purpose of Atomic

### Java for Python Programmers. Comparison of Python and Java Constructs Reading: L&C, App B

Java for Python Programmers Comparison of Python and Java Constructs Reading: L&C, App B 1 General Formatting Shebang #!/usr/bin/env python Comments # comments for human readers - not code statement #

### Overview of C. Basic Data Types Constants Variables Identifiers Keywords Basic I/O

Overview of C Basic Data Types Constants Variables Identifiers Keywords Basic I/O NOTE: There are six classes of tokens: identifiers, keywords, constants, string literals, operators, and other separators.

### Senet. Language Reference Manual. 26 th October Lilia Nikolova Maxim Sigalov Dhruvkumar Motwani Srihari Sridhar Richard Muñoz

Senet Language Reference Manual 26 th October 2015 Lilia Nikolova Maxim Sigalov Dhruvkumar Motwani Srihari Sridhar Richard Muñoz 1. Overview Past projects for Programming Languages and Translators have

### Language Fundamentals Summary

Language Fundamentals Summary Claudia Niederée, Joachim W. Schmidt Software Systems Institute Object-oriented Analysis and Design 1998/99 c.niederee@tu-harburg.de http://www.sts.tu-harburg.de Keywords

### JAC444 - Lecture 1. Introduction to Java Programming Language Segment 4. Jordan Anastasiade Java Programming Language Course

JAC444 - Lecture 1 Introduction to Java Programming Language Segment 4 1 Overview of the Java Language In this segment you will be learning about: Numeric Operators in Java Type Conversion If, For, While,

### Work relative to other classes

Work relative to other classes 1 Hours/week on projects 2 C BOOTCAMP DAY 1 CS3600, Northeastern University Slides adapted from Anandha Gopalan s CS132 course at Univ. of Pittsburgh Overview C: A language

### 2 nd Week Lecture Notes

2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous

### FIT9133 Module 1: Introduction to Algorithms and Python Programming Basics

FIT9133 Module 1: Introduction to Algorithms and Python Programming Basics FIT9133 Foundations of Programming in Python Jojo Wong i FIT9133 Module 1: Introduction to Algorithms and Python Programming Basics

### Decaf Language Reference

Decaf Language Reference Mike Lam, James Madison University Fall 2016 1 Introduction Decaf is an imperative language similar to Java or C, but is greatly simplified compared to those languages. It will

### 9/21/17. Outline. Expression Evaluation and Control Flow. Arithmetic Expressions. Operators. Operators. Notation & Placement

Outline Expression Evaluation and Control Flow In Text: Chapter 6 Notation Operator evaluation order Operand evaluation order Overloaded operators Type conversions Short-circuit evaluation of conditions

### Language Fundamentals Summary

Language Fundamentals Summary Claudia Niederée, Joachim W. Schmidt, Michael Skusa Software Systems Institute Object-oriented Analysis and Design 1999/2000 c.niederee@tu-harburg.de http://www.sts.tu-harburg.de

### RTL Reference 1. JVM. 2. Lexical Conventions

RTL Reference 1. JVM Record Transformation Language (RTL) runs on the JVM. Runtime support for operations on data types are all implemented in Java. This constrains the data types to be compatible to Java's

### Informatics Ingeniería en Electrónica y Automática Industrial

Informatics Ingeniería en Electrónica y Automática Industrial Operators and expressions in C Operators and expressions in C Numerical expressions and operators Arithmetical operators Relational and logical

### C++ Basic Elements of COMPUTER PROGRAMMING. Special symbols include: Word symbols. Objectives. Programming. Symbols. Symbols.

EEE-117 COMPUTER PROGRAMMING Basic Elements of C++ Objectives General Questions Become familiar with the basic components of a C++ program functions, special symbols, and identifiers Data types Arithmetic

### Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Introduction: PHP (Hypertext Preprocessor) was invented by Rasmus Lerdorf in 1994. First it was known as Personal Home Page. Later

### MR Language Reference Manual. Siyang Dai (sd2694) Jinxiong Tan (jt2649) Zhi Zhang (zz2219) Zeyang Yu (zy2156) Shuai Yuan (sy2420)

MR Language Reference Manual Siyang Dai (sd2694) Jinxiong Tan (jt2649) Zhi Zhang (zz2219) Zeyang Yu (zy2156) Shuai Yuan (sy2420) 1 MR Language Reference Manual 1. Introduction 1.1 Concept of MapReduce

### RUBY OPERATORS. Ruby Arithmetic Operators: Ruby Comparison Operators:

http://www.tutorialspoint.com/ruby/ruby_operators.htm RUBY OPERATORS Copyright tutorialspoint.com Ruby supports a rich set of operators, as you'd expect from a modern language. Most operators are actually

### 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

### STUDENT OUTLINE. Lesson 8: Structured Programming, Control Structures, if-else Statements, Pseudocode

STUDENT OUTLINE Lesson 8: Structured Programming, Control Structures, if- Statements, Pseudocode INTRODUCTION: This lesson is the first of four covering the standard control structures of a high-level

### HAWK Language Reference Manual

HAWK Language Reference Manual HTML is All We Know Created By: Graham Gobieski, George Yu, Ethan Benjamin, Justin Chang, Jon Adelson 0. Contents 1 Introduction 2 Lexical Convetions 2.1 Tokens 2.2 Comments

### B.V. Patel Institute of Business Management, Computer & Information Technology, Uka Tarsadia University

Unit 1 Programming Language and Overview of C 1. State whether the following statements are true or false. a. Every line in a C program should end with a semicolon. b. In C language lowercase letters are

### 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

### Pace University. Fundamental Concepts of CS121 1

Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction

### UNIVERSITÀ DI PADOVA. < 2014 March >

UNIVERSITÀ DI PADOVA < 2014 March > Easy-to-learn: Python has relatively few keywords, simple structure, and a clearly defined syntax. Easy-to-read: Python code is much more clearly defined and visible

### The C Programming Language. (with material from Dr. Bin Ren, William & Mary Computer Science)

The C Programming Language (with material from Dr. Bin Ren, William & Mary Computer Science) 1 Overview Motivation Hello, world! Basic Data Types Variables Arithmetic Operators Relational Operators Assignments

### 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

### COMS W4115 Programming Languages & Translators GIRAPHE. Language Reference Manual

COMS W4115 Programming Languages & Translators GIRAPHE Language Reference Manual Name UNI Dianya Jiang dj2459 Vince Pallone vgp2105 Minh Truong mt3077 Tongyun Wu tw2568 Yoki Yuan yy2738 1 Lexical Elements

### Java Programming Fundamentals. Visit for more.

Chapter 4: Java Programming Fundamentals Informatics Practices Class XI (CBSE Board) Revised as per CBSE Curriculum 2015 Visit www.ip4you.blogspot.com for more. Authored By:- Rajesh Kumar Mishra, PGT (Comp.Sc.)

### Object-Oriented Programming. Topic 2: Fundamental Programming Structures in Java

Electrical and Computer Engineering Object-Oriented Topic 2: Fundamental Structures in Java Maj Joel Young Joel.Young@afit.edu 8-Sep-03 Maj Joel Young Java Identifiers Identifiers Used to name local variables

### Java Programming Language. 0 A history

Java Programming Language 0 A history How java works What you ll do in Java JVM API Java Features 0Platform Independence. 0Object Oriented. 0Compiler/Interpreter 0 Good Performance 0Robust. 0Security 0

### Programming Language Basics

Programming Language Basics Lecture Outline & Notes Overview 1. History & Background 2. Basic Program structure a. How an operating system runs a program i. Machine code ii. OS- specific commands to setup

### Course Outline Introduction to C-Programming

ECE3411 Fall 2015 Lecture 1a. Course Outline Introduction to C-Programming Marten van Dijk, Syed Kamran Haider Department of Electrical & Computer Engineering University of Connecticut Email: {vandijk,

### Darshan Institute of Engineering & Technology for Diploma Studies

Overview of Microsoft.Net Framework: The Dot Net or.net is a technology that is an outcome of Microsoft s new strategy to develop window based robust applications and rich web applications and to keep

### LECTURE 02 INTRODUCTION TO C++

PowerPoint Slides adapted from *Starting Out with C++: From Control Structures through Objects, 7/E* by *Tony Gaddis* Copyright 2012 Pearson Education Inc. COMPUTER PROGRAMMING LECTURE 02 INTRODUCTION

### Java Primer 1: Types, Classes and Operators

Java Primer 1 3/18/14 Presentation for use with the textbook Data Structures and Algorithms in Java, 6th edition, by M. T. Goodrich, R. Tamassia, and M. H. Goldwasser, Wiley, 2014 Java Primer 1: Types,

### Programming Languages: Part 2. Robert M. Dondero, Ph.D. Princeton University

Programming Languages: Part 2 Robert M. Dondero, Ph.D. Princeton University 1 Objectives You will learn/review: In C, Java, and Python... Terminal input/output Data types, operators, statements Multi-file

### CS4120/4121/5120/5121 Spring 2016 Xi Language Specification Cornell University Version of May 11, 2016

CS4120/4121/5120/5121 Spring 2016 Xi Language Specification Cornell University Version of May 11, 2016 In this course you will start by building a compiler for a language called Xi. This is an imperative,

### Objectives. Chapter 2: Basic Elements of C++ Introduction. Objectives (cont d.) A C++ Program (cont d.) A C++ Program

Objectives Chapter 2: Basic Elements of C++ In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates

### Ruby: Introduction, Basics

Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 4 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie

### Getting started with Java

Getting started with Java Magic Lines public class MagicLines { public static void main(string[] args) { } } Comments Comments are lines in your code that get ignored during execution. Good for leaving

### Operators in C. Staff Incharge: S.Sasirekha

Operators in C Staff Incharge: S.Sasirekha Operators An operator is a symbol which helps the user to command the computer to do a certain mathematical or logical manipulations. Operators are used in C