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

Similar documents
MATVEC: MATRIX-VECTOR COMPUTATION FINAL REPORT. John C. Murphy jcm2105 Programming Languages and Translators Professor Stephen Edwards

YOLOP Language Reference Manual

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

XQ: An XML Query Language Language Reference Manual

Language Reference Manual simplicity

DINO. Language Reference Manual. Author: Manu Jain

Programming Languages & Translators. XML Document Manipulation Language (XDML) Language Reference Manual

CHIL CSS HTML Integrated Language

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

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

Typescript on LLVM Language Reference Manual

The SPL Programming Language Reference Manual

JME Language Reference Manual

1 Lexical Considerations

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

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

GraphQuil Language Reference Manual COMS W4115

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

The PCAT Programming Language Reference Manual

Template Language and Syntax Reference

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

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

CLIP - A Crytographic Language with Irritating Parentheses

DaMPL. Language Reference Manual. Henrique Grando

COLOGO A Graph Language Reference Manual

DEPARTMENT OF MATHS, MJ COLLEGE

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

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

Sprite an animation manipulation language Language Reference Manual

CS 4240: Compilers and Interpreters Project Phase 1: Scanner and Parser Due Date: October 4 th 2015 (11:59 pm) (via T-square)

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

FRAC: Language Reference Manual

Lexical Considerations

Java Notes. 10th ICSE. Saravanan Ganesh

The Warhol Language Reference Manual

Lexical Considerations

Unit 3. Operators. School of Science and Technology INTRODUCTION

Unit-II Programming and Problem Solving (BE1/4 CSE-2)

A simple syntax-directed

Review of the C Programming Language for Principles of Operating Systems

d-file Language Reference Manual

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

easel LANGUAGE REFERENCE MANUAL

GAWK Language Reference Manual

3. Java - Language Constructs I

Programming in C++ 5. Integral data types

Computer Programming CS F111

Petros: A Multi-purpose Text File Manipulation Language

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

EZ- ASCII: Language Reference Manual

COMS W4115 Programming Languages & Translators FALL2008. Reference Manual. VideO Processing Language (VOPL) Oct.19 th, 2008

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

Review of the C Programming Language

Chapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.

PieNum Language Reference Manual

SMPL - A Simplified Modeling Language for Mathematical Programming

Lecture 3 Tao Wang 1

Chapter 2, Part III Arithmetic Operators and Decision Making

These are reserved words of the C language. For example int, float, if, else, for, while etc.

GBL Language Reference Manual

ARG! Language Reference Manual

4. Inputting data or messages to a function is called passing data to the function.

egrapher Language Reference Manual

CPS 506 Comparative Programming Languages. Syntax Specification

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

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

Language Reference Manual

ASML Language Reference Manual

Visual C# Instructor s Manual Table of Contents

BASIC ELEMENTS OF A COMPUTER PROGRAM

LESSON 1. A C program is constructed as a sequence of characters. Among the characters that can be used in a program are:

QUark Language Reference Manual

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

Programming Lecture 3

HAWK Language Reference Manual

SFPL Reference Manual

Character Set. The character set of C represents alphabet, digit or any symbol used to represent information. Digits 0, 1, 2, 3, 9

Will introduce various operators supported by C language Identify supported operations Present some of terms characterizing operators

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION

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

Chapter 2. Lexical Elements & Operators

The pixelman Language Reference Manual. Anthony Chan, Teresa Choe, Gabriel Kramer-Garcia, Brian Tsau

Decaf Language Reference Manual

Basics of Programming

GOLD Language Reference Manual

6.096 Introduction to C++ January (IAP) 2009

COMP Primitive and Class Types. Yi Hong May 14, 2015

PYTHON- AN INNOVATION

L-System Fractal Generator: Language Reference Manual

MATLIP: MATLAB-Like Language for Image Processing

String Computation Program

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

M/s. Managing distributed workloads. Language Reference Manual. Miranda Li (mjl2206) Benjamin Hanser (bwh2124) Mengdi Lin (ml3567)

Full file at

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

corgi Language Reference Manual COMS W4115

Programming and Data Structures

IC Language Specification

Data Types and Variables in C language

Stating the obvious, people and computers do not speak the same language.

Transcription:

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 this manual is to serve as a reliable reference manual for describing the MatVec language. This manual provides a general outline of the language and a detailed description of its grammar. The language describes the lexical conventions used by the language as well as the syntax notation, grammar, identifiers, and operators. Lexical Conventions Tokens There are five classes of tokens that are used with this language. These tokens include: identifiers, keywords, constants, operators, and other separators. For the most part, white space is used to separate different tokens in the language. In the context of this language, white space refers to spaces, tabs, and new lines. Comments Comments are denoted by the use of the /* and */ characters (as in the C language). The /* character denotes the start of the comment and the */ character denotes the end of the comment string. The language does not support the use of nested comments. Single-line comments can be used by using the // symbol. Identifiers An identifier is a sequence of letters and numbers that represents a value. Like in the C language, the first character of an identifier must be a letter. The underscore is not supported as a letter in this language. Keywords The following identifiers are reserved as keywords in the MatVec language and may not be used for any other purpose: const else endif float if int matrix normalize print read then while vector

Constants A constant represents a fixed value that should be properly declared before it is used. There are four kinds of constants that are allowed in MatVec: an integer constant, a floating point constant, a vector constant, and a matrix constant. These different types of constants correspond to the identifier types that are described in the Identifier Types section. Meaning of Identifiers Identifier Types There are four basic identifier types in MatVec. The four types of identifiers that are allowed in MatVec are: integer type, floating point type, vector, and matrix. All of these types are described below: An integer type is a sequence of digits that represents an integer. Only decimal (Base 10) numbers are supported in this language. A floating point type is a sequence of digits that contains a decimal point somewhere in the value. In other words, a floating point number contains an integer part, a decimal point, and a fractional part. However, the floating point constant cannot consist of just a decimal point. A vector type is either a mathematical entity that represents a vector. A matrix type is a set of numbers that represents a matrix entity in mathematics. Expressions Primary Expressions A Primary Expression consists of identifiers, constants, or expressions that are contained within parentheses. The parentheses around the expression do not affect the outcome of the contained expression. Unary Plus Operator The unary + operator is simply the result of the value of the operand. The operand can be either an integer or floating point number. Unary Minus Operator The unary operator is the negative result of the value of the operand. The operand can be either an integer or floating point number. Multiplicative Operators

The multiplicative operators of the language are * and /. Both of these operators require two operands and both operations are performed from left-to-right (left-associative operation). The * operator denotes multiplication and the / operator denotes division. Additive Operators The additive operators of the language are + and -. Both of these operators require two operands and the both operations are performed from left-to-right (left-associative operation). The + operator denotes multiplication and the / operator denotes division. Relational Operators The relational operators in the MatVec language are a subset of the relational operators that are used in the C language. Relational operators are used to determine whether a comparison between two operands is true or false and returns the result. Therefore, although the operation is left-associative, this fact by itself is not very useful. Since the expression a<b<c is parsed as (a<b)<c, this expression is invalid since (a<b) yields either true or false. The values of true or false cannot be one side of the relational operator. These are the relational operators that are used by the MatVec language: <, <=, >=, > Less Than (<) operator Less Than or Equal To (<=) operator Greater Than (>) operator Greater Than or Equal To (>=) operator Equality Operators The equality operators in the MatVec language are similar to the equality operators that are used in the C language. The equality operators are similar to the relational operators in that they will return a value of true or false. These are the equality operators that are used by the MatVec language: ==,!= Equal To (==) operator Not Equal To (!=) operator Assignment Expression The assignment expression that is used in MatVec is the = operator. In the assignment expression, the value of the left operand of this expression, known as the lvalue, is reassigned to the result of the right operand. The lvalue of the expression, therefore, needs to be a valid identifier; it cannot be a constant. Operator Precedence and Order of Evaluation The following table shows the precedence and order of evaluation of the different operators used in MatVec. The order of precedence shown in the table is a subset of the Operator Precedence and Associativity hierarchy from the C language.

Operator Name Operator Symbol Operator Associativity Unary Operator + - Right to Left Multiplicative Operator * / Left to Right Additive Operator + - Left to Right Relational/Equality < <= >= > ==!= Left to Right Operators Assignment Operator = Right to Left Declarations In MatVec, identifiers and constants need to be declared before they are used. Declarations start with the identifier type followed by a list of identifiers or constants to be declared. Here is an example of identifier declarations: int i, j; matrix u, v; float g, h; Here is an example of constant declarations: const int x = 3, y = 5; const matrix m = [1 2 3 4 5 6 7 8 9]; Statements Statements are expressions in MatVec that are executed in sequential order. Statements in MatVec are similar to statements in C. Conditional Statement A conditional statement is an if-else statement where the code in the brackets is executed only when the if conditional is met. The else part of the conditional statement is optional and is only executed if the conditional is not met. Here is the iterative statement: if (conditional) { } else { } endif

Iterative Statement An iterative statement is the while loop that keeps executing a portion of code until the condition is satisfied. Here is the iterative statement: while (conditional) { } Functions The following are functions that are available in MatVec: read(); print(); normalize(); The print() statement can be used to print out an identifier of any type in the language. The print statement can print out results such as the output of an integer, a vector, or a matrix value. The read() statement is used to read in an identifier value from standard input and assign the input to an identifier. The normalize() function takes a vector as its input and computes the normalized values of the input vector.