# Angela Z: A Language that facilitate the Matrix wise operations Language Reference Manual

Size: px
Start display at page:

Download "Angela Z: A Language that facilitate the Matrix wise operations Language Reference Manual"

Transcription

1 Angela Z: A Language that facilitate the Matrix wise operations Language Reference Manual Contents Fei Liu, Mengdi Zhang, Taikun Liu, Jiayi Yan 1. Language definition Usage What special feature do we have? Example Lexical Conventions Comments Identifiers Keywords Literals Types Literal primitive types Literal collection type Operators Punctuators.7 3. Meaning of Identifiers Scoping Object Types Type Conversions 9 5. Expressions and Operators Precedence and Associativity Rule Primary Expressions Function Calls Additive Operators Multiplicative Operators Relational Operators Equality Operators Boolean Operators Assignment Operators

2 5.10. Initialization Operators Element Access Operators Declarations Function Declarations Variable Declarations Statements Block Conditional Statement For Loops While Loops Return Statement System Functions print() Function

3 1. Language definition 1.1. Usage Angela Z is a language designed for computing and tracing option pricings. It can also be used as a general purpose programming language What special feature do we have? We support the built in Matrix and Option class. Matrix wise operations such as Plus, Minus, Multiply, and Division are all supported. Direct matrix declaration, operations, and access are supported with minimum effort. Option is provided for option pricing computing. The language should be able to shelter the user from intensive loops and manipulation of matrices or collection of option pricing data Example: {**The following piece code express a LU decomposition algorithm**} float s; matrix U; matrix L; matrix PV; s=size(a); U=A; L(s,s); PV=transpose(A[0 to s 1]); for( float j=1;j<s;j++) { float ind; ind=max(abs(u[j to s, j])); ind=ind+j 1; matrix t; t=pv[j]; PV[j]=PV[ind]; PV[ind]=t; t=l[j,1 to j 1]; L[j,1 to j 1]=L[ind,1 to j 1]; L[ind,1 to j 1]=t; t=u[j,j to end]; U[j,j to end]=u[ind,j to end]; U[ind,j to end]=t; L[j,j]=1; for( float i=(1+j);i< size(u,1);i++) { float c; c= U[i,j]/U[j,j]; U[i,j to s]=u[i,j to s] U[j,j to s]*c; L[i,j]=c; } } 2. Lexical Conventions 3

4 2.1. Comments Comments are delimited by {* and *}, like {* This a single-line comment.*} {* This is a block comment.*} We currently only support block comments and no single line comment syntax like // in c Identifiers An identifier is a combination of a series of characters, which include letters, digits as well as underscore _. The identifiers are case sensitive which mean that Foo is not the same as foo. And it can only start with letters Keywords The following are a list of reserved keywords in the language and can not be used as variable or function names. if else for while return Boolean: true, false Matrix Structure Option Int Float String Void 2.4. Literals Types Literal primitive types The following table contains examples of literal primitive types. 4

5 integer float e string boolean Hello World true false Integer An integer consists of a sequence of digits and no a decimal point. Integers are represented only in decimal notation. Float A float can be represented in two forms. One consists of an integer part and a decimal part. The second form also contains an integer part, as well as an e or E, an optionally signed integer exponent. String A string is enclosed in double quotation, for example "Hello World". Boolean A boolean is either true or false. It has no other value Literal collection type Matrix A matrix data type consists rows and columns of floats. The elements in the matrix can be accessed by its index, for example m[1,2] can access the element in the first row and second column of matrix m Operators An operator is an evaluation performed on one or more operands. Each data type has its own set of operators. Operators for Int, Float 5

6 Symbol Explanation + Performs addition Performs minus * Performs multiplication / Performs division = Performs assignment Operators for String Symbol Explanation = Performs assignment Operators for Matrix Symbol Explanation +. Performs addition. Performs minus *. Performs multiplication /. Performs division = Performs assignment (, ) Performs initialization [, ] Performs index accessing Operators for Option, Structure Symbol Explanation = Performs assignment ( : ) Performs initialization > Performs element accessing in the object Operators for Boolean 6

7 Symbol && Explanation Performs AND operation of two Boolean expressions Performs OR operation of two Boolean expressions Equality Operators Symbol Explanation == Test whether two expressions are equal!= Test whether two expressions are different Relational Operators Symbol Explanation <= Test whether left expression is smaller or equal to right expression < Test whether left expression is greater than right expression >= Test whether left expression is greater or equal to right expression > Test whether left expression is greater to right expression 2.6. Punctuators A punctuator is a symbol that does not specify a specific operation to be performed. It has a syntactic meaning to compiler and is primarily used in formatting code. A punctuator is one of the symbols below: Symbol ; Example Statement terminator {} Block of Statements 3. Meaning of Identifiers 3.1. Object Types Our language supports the four fundamental types of objects: integer floating point 7

8 string boolean And we supports advanced types of objects: Matrix Structure Option Character Types The only supported character type is the string type. This can store a string of potentially unlimited length and does not have an upper bound limit. The length is only limited by the amount of computing resources (e.g. memory) available. Integer and Floating Point types The only supported integer type is int and the only supported floating point type is float. Both of these data types are signed. Boolean Type This type is a truth value and can only store a bit of information. Specifically, it may only take a value of either true or false. Matrix Type This type only supports two dimensional matrix. This can store a matrix of potentially unlimited length along each dimension and does not have an upper bound limit. The size of this type is only limited by computing resources available. This can only store float point type values. Structure Type This type is kind like map type. It can store pairs of (key, value). There is no upper bound for storing key value pairs. Key must be a string type and value must be a float type. Option Type This type is an extension of Structure Type. It has some built in functions and preset (key, value) pairs. 4. Type Conversions No type conversion is allowed. 8

9 5. Expressions and Operators 5.1. Precedence and Associativity Rule The following table is a list of operator precedence and associativity for operators. Operators on the same row are of the same precedence and the table is in the order from highest to lowest precedence. There is no parentheses to force precedence in the language. Initialization, i.e., Structure or Option initialization ( : ) and Matrix initialization (, ), only appears in expression which contains only itself, so there is no need to assign precedence order to initialization. Operator Symbol Operator Description Associativity > Structure or Option element accessing Left [, ] Matrix element accessing Non associativ e * / *. /. Times, Divide, Matrix times, Matrix divide Left Plus, Minus, Matrix plus, Matrix minus Left < <= > >= Less than, Less than or equal to, Larger than, Larger than or equal to Left ==!= && Equality, Inequality, Logical AND, Logical OR Left = Assignment Right 5.2. Primary Expressions The following are all considered to be primary expressions: Identifiers: An identifier refers to either a variable or a function. Examples include x_1 and hilbert, but not 2nd. Constants: A constant s type is defined by its form and value. See Section 2.4 for examples of constants. String literals: String literals are translated directly to Java strings by our compiler, and are treated accordingly. 9

10 Parenthesized expressions: A parenthesized expression s type and value are equal to those of the un parenthesized expression. The presence of parentheses is used to identify an expression s precedence and its evaluation priority Function Calls To be able to call a function, it must be declared and implemented before. Calling a function that hasn t been defined before causes an error. To call a function, the syntax is: function_name(first argument, second argument,...). The function call returns the value of the data type defined as return type in the function declaration. Note that when calling the function, the arguments should be of the same order and the same data types as defined in function declaration. Otherwise, error occurs. For example, if a function declaration is as follows: Int diff(int a, Int b) { return a-b; } Valid function call is like: diff(0, 1); Invalid function calls are as follows: diff(0, 1.2); {* second argument is of incorrect data type *} diff(0); {* number of arguments is different from what is defined in declaration *} 5.4. Additive Operators The additive operators are binary operators with left to right associativity: Plus (+) Minus ( ) Matrix Plus (+.) Matrix Minux (.) Types used with the first two additive operators are Int and Float. The result of the plus (+) operator is the sum of the operands. The result of the minus ( ) operator is the difference between the operands. Note that operands before and after operators should of same type. Plus or minus of an Int and a Float is not supported. 10

11 Int a; Int b; a = 3; b = a + 2; {* b = 5.*} Types used with the last two additive operators are Matrix. Matrix Plus (+.) operator performs entrywise summation of elements of two matrixes. Matrix Minus (.) operator performs entrywise subtraction of elements of two matrixes. Note that Matrix before and after operators should of same size. All elements in the matrix are treated as Float. Matrix a(2,3,4); Matrix b(1,2,3); Matrix c; c = a - b; {* c is a matrix of size 1*3: 1,1,1*} 5.5. Multiplicative Operators The multiplicative operators are binary operators with left to right associativity: Times (*) Divide (/) Matrix Times (*.) Matrix Divide (/.) Types used with the first two multiplicative operators are Int and Float. The multiplication operator (*) yields the result of multiplying the first operand by the second. The division operator (/) yields the result of dividing the first operand by the second. Division by 0 is undefined and not allowed. Note that operands before and after operators should of same type. Multiplication or division of an Int and a Float is not supported. 11

12 Float a; Float b; a = 1.1; b = a * 0.2; {* b = 2.2*} Types used with the last two multiplicative operators are Matrix. Matrix multiplication (*.) operator performs row by column multiplication of two matrixes. Matrix division (/.) operator performs row by column division of two matrixes. Note that number of columns in the Matrix before the operator equals the number of rows in the one after the operator. All elements in the matrix are treated as Float. Matrix a(2,0); Matrix b((1,2),(0,1)); Matrix c; c = a *. b; {* c is a matrix of size 1*2: 2,0*} 5.6. Relational Operators The relational operators are binary operators with left to right associativity: Less than (<) Greater than (>) Less than or equal to (<=) Greater than or equal to (>=) Types used with the relational operators are Int and Float. They yield values of type Boolean. The value returned is false (0) if the relationship in the expression is false; otherwise, the value returned is true (1). Relation comparison of an Int and a Float is not supported. Float a; Int b; a = 1.1; b = 2; if ( a >= 1.1 ) {...} if ( a < b ) 12

13 {...} {* a >= 1.1 returns true a < b gives an error since a is Float and b is Int *} 5.7. Equality Operators The equality operators are binary operators with left to right associativity: Equal to (==) Not equal to (!=) Types used with the relational operators are Int and Float and String. The equal to operator (==) returns true (1) if both operands have the same value; otherwise, it returns false (0). The not equal to operator (!=) returns true if the operands do not have the same value; otherwise, it returns false. Equality comparison of two types is not supported. Float a; String b; a = 1.1; b = str ; if ( b == st ) {...} if ( a == b ) {...} {* *} b == st returns false a == b gives an error since a is Float and b is String 5.8. Boolean Operators The Boolean operators are binary operators with left to right associativity: AND (&&) OR ( ) 13

14 Types used with the Boolean operators are Boolean. The logical AND operator (&&) returns the Boolean value true if both operands are true and returns false otherwise. The operands are implicitly converted to type Boolean prior to evaluation. if ( true && false ) {...} if ( 1 == 1 false ) {...} {* *} true && false returns false 1 == 1 false returns true since 1 == 1 is evaluated as true 5.9. Assignment Operators The assignment operators are binary operators with right to left associativity: Assign (=) Types used with the assignment operators are Int, Float, Boolean, String, Structure, Matrix, Option, Assignment stores the value of the second operand in the first operand. Assignment between different types are not allowed. Float a; Float b; a = 1.1; b = a * 2.0; {* a is assigned value of 1.1 b is assigned value of 2.2 *} Initialization Operators The Initialization Operators have no associativity: Structure or Option initialization (( : )) Matrix initialization ((, )) 14

15 Types used with the first initialization operator are Structure and Option. It should be of format Type Id(key:value, key:value.). Note that trying to access a Structure or Option that hasn t been initialized causes error. Option a(id:5, country: China ); {* a is initialized as Option Object which has two elements: id(5) and country( China ) *} Type used with the second initialization operator is Matrix. A row is represented as (,,...). A matrix with one row is initialized in the format Type Id(value, value,...). A matrix with several rows is initialized in the format Type Id(value, value,...).note that trying to access a Structure or Option that hasn t been initialized causes error. Option a(id:5, country: China ); {* a is initialized as Option Object which has two elements: id(5) and country( China ) *} Element Access Operators The Element Access Operators: Structure or Option element Access ( >) Matrix element Access ([, ]) Types used with the first element access operator are Structure and Option. It returns the object in the index position indicated by the int number after the operator. Index starts from 0. An index range check is performed before trying to access elements and error occurs if index is out of range. Option a(id:5, country: China ); if ( a->1 == China ) {...} {* a->1 returns China and so a->1 == China is true *} Types used with the second element access operator are Matrix. It returns the object in the index position indicated by the pair [row index, column index]. Row and column starts from 0. An index range check is performed before trying to access elements and error occurs if index is out of range. 15

16 Matrix a(1,2,3); Int b; b = a[0,2] {* b = 3 *} 6. Declarations 6.1. Function Declarations Functions consist of a function header and a function body. The function header contains return type, function name, and parameter list. The function name must be a valid identifier. The function body is enclosed in braces. For example: int foo( int a, int b) { } 6.2. Variable Declarations Variables are declared in the following way: datatype varname; datatype could be int, float, string, boolean, void, matrix, option, option. varname must be a valid identifier that is a combination of characters, and can only begin with letters. The variables and constants could be initialized with a literal value, an arithmetic expression or be set equal to another variable or constant that has already been declared in this scope. The type of the value and the type of variable it has been assigned to must match with each other. The following are some examples of variable declaration and initialization. int a; int a = 3; int a = 2 + 3; int b = a; 7. Statements 7.1. Block A block encloses a series of statements by braces. { 16

17 stmt1; stmt2; stmt3; } 7.2. Conditional Statement There are two forms of conditional statement that consist of a if and an optional else. if ( boolean expression) { stmt1 } if ( boolean expression) stmt1 else stmt2 The boolean expression will be evaluated first, and if it is true then stmt1 will be executed, otherwise, in the second case, stmt2 will be executed For Loops For loops are in the following format: for (expr1, b_expr, expr2) stmt expr1 is evaluated only once during first iteration, the b_expr is a boolean expression and it is checked before each iteration, if it is true, then the stmt is executed. expr2 is executed in the end of each iteration While Loops While loops are in the following format: while (b_expr) stmt The b_expr is a boolean expression and it is evaluated before every iteration. If it is true then the statement stmt will be executed. The loop will stop when b_expr is evaluated false Return Statement Return statement have two formats: return stmt; return; Functions could contain a return statement, it could have another statement or just an empty return statement. 17

18 8. System Functions 8.1. print() Function The print function is used to output a variable s value or a string literal. For example: int a = 3; print (a); {* 3 *} print ( Hello World! ); {* Hello World! *} 18

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

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

### IPCoreL. Phillip Duane Douglas, Jr. 11/3/2010

IPCoreL Programming Language Reference Manual Phillip Duane Douglas, Jr. 11/3/2010 The IPCoreL Programming Language Reference Manual provides concise information about the grammar, syntax, semantics, and

### FRAC: Language Reference Manual

FRAC: Language Reference Manual Justin Chiang jc4127 Kunal Kamath kak2211 Calvin Li ctl2124 Anne Zhang az2350 1. Introduction FRAC is a domain-specific programming language that enables the programmer

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

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

### 1 Lexical Considerations

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

### CHIL CSS HTML Integrated Language

CHIL CSS HTML Integrated Language Programming Languages and Translators Fall 2013 Authors: Gil Chen Zion gc2466 Ami Kumar ak3284 Annania Melaku amm2324 Isaac White iaw2105 Professor: Prof. Stephen A. Edwards

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

### PieNum Language Reference Manual

PieNum Language Reference Manual October 2017 Hadiah Venner (hkv2001) Hana Fusman (hbf2113) Ogochukwu Nwodoh( ocn2000) Index Introduction 1. Lexical Convention 1.1. Comments 1.2. Identifiers 1.3. Keywords

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

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

### MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards

MATVEC: MATRIX-VECTOR COMPUTATION LANGUAGE REFERENCE MANUAL John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards Language Reference Manual Introduction The purpose of

### Typescript on LLVM Language Reference Manual

Typescript on LLVM Language Reference Manual Ratheet Pandya UNI: rp2707 COMS 4115 H01 (CVN) 1. Introduction 2. Lexical Conventions 2.1 Tokens 2.2 Comments 2.3 Identifiers 2.4 Reserved Keywords 2.5 String

### VENTURE. Section 1. Lexical Elements. 1.1 Identifiers. 1.2 Keywords. 1.3 Literals

VENTURE COMS 4115 - Language Reference Manual Zach Adler (zpa2001), Ben Carlin (bc2620), Naina Sahrawat (ns3001), James Sands (js4597) Section 1. Lexical Elements 1.1 Identifiers An identifier in VENTURE

### Lexical Considerations

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a

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

### DaMPL. Language Reference Manual. Henrique Grando

DaMPL Language Reference Manual Bernardo Abreu Felipe Rocha Henrique Grando Hugo Sousa bd2440 flt2107 hp2409 ha2398 Contents 1. Getting Started... 4 2. Syntax Notations... 4 3. Lexical Conventions... 4

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

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.

### Language Reference Manual

ALACS Language Reference Manual Manager: Gabriel Lopez (gal2129) Language Guru: Gabriel Kramer-Garcia (glk2110) System Architect: Candace Johnson (crj2121) Tester: Terence Jacobs (tj2316) Table of Contents

### Petros: A Multi-purpose Text File Manipulation Language

Petros: A Multi-purpose Text File Manipulation Language Language Reference Manual Joseph Sherrick js2778@columbia.edu June 20, 2008 Table of Contents 1 Introduction...................................................

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

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

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

### 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 pixelman Language Reference Manual. Anthony Chan, Teresa Choe, Gabriel Kramer-Garcia, Brian Tsau

The pixelman Language Reference Manual Anthony Chan, Teresa Choe, Gabriel Kramer-Garcia, Brian Tsau October 2017 Contents 1 Introduction 2 2 Lexical Conventions 2 2.1 Comments..........................................

### AN OVERVIEW OF C, PART 3. CSE 130: Introduction to Programming in C Stony Brook University

AN OVERVIEW OF C, PART 3 CSE 130: Introduction to Programming in C Stony Brook University FANCIER OUTPUT FORMATTING Recall that you can insert a text field width value into a printf() format specifier:

### Ordinary Differential Equation Solver Language (ODESL) Reference Manual

Ordinary Differential Equation Solver Language (ODESL) Reference Manual Rui Chen 11/03/2010 1. Introduction ODESL is a computer language specifically designed to solve ordinary differential equations (ODE

### \n is used in a string to indicate the newline character. An expression produces data. The simplest expression

Chapter 1 Summary Comments are indicated by a hash sign # (also known as the pound or number sign). Text to the right of the hash sign is ignored. (But, hash loses its special meaning if it is part of

### Decaf Language Reference Manual

Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY 11794-4400 cram@cs.stonybrook.edu February 12, 2012 Decaf is a small object oriented

### 1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...

Contents 1 Introduction 3 1.1 Java, the beginning.......................... 3 1.2 Java Virtual Machine........................ 4 1.3 A First Program........................... 4 1.4 BlueJ.................................

### UNIT- 3 Introduction to C++

UNIT- 3 Introduction to C++ C++ Character Sets: Letters A-Z, a-z Digits 0-9 Special Symbols Space + - * / ^ \ ( ) [ ] =!= . \$, ; : %! &? _ # = @ White Spaces Blank spaces, horizontal tab, carriage

Visual C# 2005 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion Topics Additional Projects Additional Resources Key Terms

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

### BASIC ELEMENTS OF A COMPUTER PROGRAM

BASIC ELEMENTS OF A COMPUTER PROGRAM CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING LOGO Contents 1 Identifier 2 3 Rules for naming and declaring data variables Basic data types 4 Arithmetic operators

### Fundamental of Programming (C)

Borrowed from lecturer notes by Omid Jafarinezhad Fundamental of Programming (C) Lecturer: Vahid Khodabakhshi Lecture 3 Constants, Variables, Data Types, And Operations Department of Computer Engineering

### Expr Language Reference

Expr Language Reference Expr language defines expressions, which are evaluated in the context of an item in some structure. This article describes the syntax of the language and the rules that govern the

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

### Lecture 3 Tao Wang 1

Lecture 3 Tao Wang 1 Objectives In this chapter, you will learn about: Arithmetic operations Variables and declaration statements Program input using the cin object Common programming errors C++ for Engineers

### corgi Language Reference Manual COMS W4115

corgi Language Reference Manual COMS W4115 Philippe Guillaume Losembe (pvl2109) Alisha Sindhwani (as4312) Melissa O Sullivan (mko2110) Justin Zhao (jxz2101) October 27, 2014 Chapter 1: Introduction corgi

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

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

### There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals:

Numeric Types There are four numeric types: 1. Integers, represented as a 32 bit (or longer) quantity. Digits sequences (possibly) signed are integer literals: 1-123 +456 2. Long integers, of unlimited

### Sketchpad Graphics Language Reference Manual. Zhongyu Wang, zw2259 Yichen Liu, yl2904 Yan Peng, yp2321

Sketchpad Graphics Language Reference Manual Zhongyu Wang, zw2259 Yichen Liu, yl2904 Yan Peng, yp2321 October 20, 2013 1. Introduction This manual provides reference information for using the SKL (Sketchpad

### YOLOP Language Reference Manual

YOLOP Language Reference Manual Sasha McIntosh, Jonathan Liu & Lisa Li sam2270, jl3516 and ll2768 1. Introduction YOLOP (Your Octothorpean Language for Optical Processing) is an image manipulation language

### Chapter 2: Introduction to C++

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

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

### Declaration and Memory

Declaration and Memory With the declaration int width; the compiler will set aside a 4-byte (32-bit) block of memory (see right) The compiler has a symbol table, which will have an entry such as Identifier

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

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

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

### SSOL Language Reference Manual

SSOL Language Reference Manual Madeleine Tipp Jeevan Farias Daniel Mesko mrt2148 jtf2126 dpm2153 Manager Language Guru System Architect October 15, 2018 Contents 1 Lexical Conventions 2 1.1 Identifiers...............................................

### Learning Language. Reference Manual. George Liao (gkl2104) Joseanibal Colon Ramos (jc2373) Stephen Robinson (sar2120) Huabiao Xu(hx2104)

Learning Language Reference Manual 1 George Liao (gkl2104) Joseanibal Colon Ramos (jc2373) Stephen Robinson (sar2120) Huabiao Xu(hx2104) A. Introduction Learning Language is a programming language designed

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

### BoredGames Language Reference Manual A Language for Board Games. Brandon Kessler (bpk2107) and Kristen Wise (kew2132)

BoredGames Language Reference Manual A Language for Board Games Brandon Kessler (bpk2107) and Kristen Wise (kew2132) 1 Table of Contents 1. Introduction... 4 2. Lexical Conventions... 4 2.A Comments...

### Programming for Engineers Introduction to C

Programming for Engineers Introduction to C ICEN 200 Spring 2018 Prof. Dola Saha 1 Simple Program 2 Comments // Fig. 2.1: fig02_01.c // A first program in C begin with //, indicating that these two lines

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

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

### CLIP - A Crytographic Language with Irritating Parentheses

CLIP - A Crytographic Language with Irritating Parentheses Author: Duan Wei wd2114@columbia.edu Yi-Hsiu Chen yc2796@columbia.edu Instructor: Prof. Stephen A. Edwards July 24, 2013 Contents 1 Introduction

### WEEK 4 OPERATORS, EXPRESSIONS AND STATEMENTS

WEEK 4 OPERATORS, EXPRESSIONS AND STATEMENTS OPERATORS Review: Data values can appear as literals or be stored in variables/constants Data values can be returned by method calls Operators: special symbols

### d-file Language Reference Manual

Erwin Polio Amrita Rajagopal Anton Ushakov Howie Vegter d-file Language Reference Manual COMS 4115.001 Thursday, October 20, 2005 Fall 2005 Columbia University New York, New York Note: Much of the content

### Full file at

Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class

### Unit 3. Operators. School of Science and Technology INTRODUCTION

INTRODUCTION Operators Unit 3 In the previous units (unit 1 and 2) you have learned about the basics of computer programming, different data types, constants, keywords and basic structure of a C program.

### Mirage. Language Reference Manual. Image drawn using Mirage 1.1. Columbia University COMS W4115 Programming Languages and Translators Fall 2006

Mirage Language Reference Manual Image drawn using Mirage 1.1 Columbia University COMS W4115 Programming Languages and Translators Fall 2006 Prof. Stephen Edwards Team Members: Abhilash I ai2160@columbia.edu

### Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1

Module 2 - Part 2 DATA TYPES AND EXPRESSIONS 1/15/19 CSE 1321 MODULE 2 1 Topics 1. Expressions 2. Operator precedence 3. Shorthand operators 4. Data/Type Conversion 1/15/19 CSE 1321 MODULE 2 2 Expressions

### A complex expression to evaluate we need to reduce it to a series of simple expressions. E.g * 7 =>2+ 35 => 37. E.g.

1.3a Expressions Expressions An Expression is a sequence of operands and operators that reduces to a single value. An operator is a syntactical token that requires an action be taken An operand is an object

### CS /534 Compiler Construction University of Massachusetts Lowell. NOTHING: A Language for Practice Implementation

CS 91.406/534 Compiler Construction University of Massachusetts Lowell Professor Li Xu Fall 2004 NOTHING: A Language for Practice Implementation 1 Introduction NOTHING is a programming language designed

### egrapher Language Reference Manual

egrapher Language Reference Manual Long Long: ll3078@columbia.edu Xinli Jia: xj2191@columbia.edu Jiefu Ying: jy2799@columbia.edu Linnan Wang: lw2645@columbia.edu Darren Chen: dsc2155@columbia.edu 1. Introduction

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

### CSc Introduction to Computing

CSc 10200 Introduction to Computing Lecture 2 Edgardo Molina Fall 2011 - City College of New York Thursday, September 1, 2011 Introduction to C++ Modular program: A program consisting of interrelated segments

### Spoke. Language Reference Manual* CS4118 PROGRAMMING LANGUAGES AND TRANSLATORS. William Yang Wang, Chia-che Tsai, Zhou Yu, Xin Chen 2010/11/03

CS4118 PROGRAMMING LANGUAGES AND TRANSLATORS Spoke Language Reference Manual* William Yang Wang, Chia-che Tsai, Zhou Yu, Xin Chen 2010/11/03 (yw2347, ct2459, zy2147, xc2180)@columbia.edu Columbia University,

### Crayon (.cry) Language Reference Manual. Naman Agrawal (na2603) Vaidehi Dalmia (vd2302) Ganesh Ravichandran (gr2483) David Smart (ds3361)

Crayon (.cry) Language Reference Manual Naman Agrawal (na2603) Vaidehi Dalmia (vd2302) Ganesh Ravichandran (gr2483) David Smart (ds3361) 1 Lexical Elements 1.1 Identifiers Identifiers are strings used

### Data and Variables. Data Types Expressions. String Concatenation Variables Declaration Assignment Shorthand operators. Operators Precedence

Data and Variables Data Types Expressions Operators Precedence String Concatenation Variables Declaration Assignment Shorthand operators Review class All code in a java file is written in a class public

### EXPRESSIONS AND ASSIGNMENT CITS1001

EXPRESSIONS AND ASSIGNMENT CITS1001 Scope of this lecture Assignment statements Expressions ASSIGNMENT STATEMENT Assignment Statements!!!mark = 50;!! Read as the value in variable on the LHS becomes equal

### Program Fundamentals

Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java

### SFPL Reference Manual

1 SFPL Reference Manual By: Huang-Hsu Chen (hc2237) Xiao Song Lu(xl2144) Natasha Nezhdanova(nin2001) Ling Zhu(lz2153) 2 1. Lexical Conventions 1.1 Tokens There are six classes of tokes: identifiers, keywords,

### Review: Exam 1. Your First C++ Program. Declaration Statements. Tells the compiler. Examples of declaration statements

Review: Exam 1 9/20/06 CS150 Introduction to Computer Science 1 1 Your First C++ Program 1 //*********************************************************** 2 // File name: hello.cpp 3 // Author: Shereen Khoja

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

### 12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.

Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started

### VLC : Language Reference Manual

VLC : Language Reference Manual Table Of Contents 1. Introduction 2. Types and Declarations 2a. Primitives 2b. Non-primitives - Strings - Arrays 3. Lexical conventions 3a. Whitespace 3b. Comments 3c. Identifiers

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

### LOON. Language Reference Manual THE LANGUAGE OF OBJECT NOTATION. Kyle Hughes, Jack Ricci, Chelci Houston-Borroughs, Niles Christensen, Habin Lee

LOON THE LANGUAGE OF OBJECT NOTATION Language Reference Manual Kyle Hughes, Jack Ricci, Chelci Houston-Borroughs, Niles Christensen, Habin Lee October 2017 1 Contents 1 Introduction 3 2 Types 4 2.1 JSON............................................

### Le L c e t c ur u e e 2 To T p o i p c i s c t o o b e b e co c v o e v r e ed e Variables Operators

Course Name: Advanced Java Lecture 2 Topics to be covered Variables Operators Variables -Introduction A variables can be considered as a name given to the location in memory where values are stored. One

### Objectives. In this chapter, you will:

Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers in C++ Explore simple data types Discover how a program evaluates arithmetic expressions Learn about

### Basics of Java Programming

Basics of Java Programming Lecture 2 COP 3252 Summer 2017 May 16, 2017 Components of a Java Program statements - A statement is some action or sequence of actions, given as a command in code. A statement

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

### Basic Operations jgrasp debugger Writing Programs & Checkstyle

Basic Operations jgrasp debugger Writing Programs & Checkstyle Suppose you wanted to write a computer game to play "Rock, Paper, Scissors". How many combinations are there? Is there a tricky way to represent

### GeoCode Language Reference Manual

GeoCode Language Reference Manual Contents 1 Introduction... 3 2 Lexical Elements... 3 2.1 Identifiers... 3 2.2 Keywords... 3 2.3 Literals... 3 2.4 Line Structure... 4 2.5 Indentation... 4 2.6 Whitespace...

### GraphQuil Language Reference Manual COMS W4115

GraphQuil Language Reference Manual COMS W4115 Steven Weiner (Systems Architect), Jon Paul (Manager), John Heizelman (Language Guru), Gemma Ragozzine (Tester) Chapter 1 - Introduction Chapter 2 - Types

### c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C

### By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program

1 By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program variables. Apply C++ syntax rules to declare variables, initialize

### Chapter 2 Working with Data Types and Operators

JavaScript, Fourth Edition 2-1 Chapter 2 Working with Data Types and Operators At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics

### Twister: Language Reference Manual

Twister: Language Reference Manual Manager: Anand Sundaram (as5209) Language Guru: Arushi Gupta (ag3309) System Architect: Annalise Mariottini (aim2120) Tester: Chuan Tian (ct2698) February 23, 2017 Contents

### IC Language Specification

CS 301 Spring 2016 IC Language Specification The IC Language For the implementation project, you will build a compiler for an object-oriented language called IC (for Irish Coffee 1 ), which is essentially

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

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

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