The Warhol Language Reference Manual

Similar documents
1 Lexical Considerations

Ordinary Differential Equation Solver Language (ODESL) Reference Manual

Lexical Considerations

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

Lexical Considerations

Language Reference Manual simplicity

ARG! Language Reference Manual

egrapher Language Reference Manual

JME Language Reference Manual

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

RTL Reference 1. JVM. 2. Lexical Conventions

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

DaMPL. Language Reference Manual. Henrique Grando

Chapter 2: Introduction to C++

Typescript on LLVM Language Reference Manual

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

GraphQuil Language Reference Manual COMS W4115

UNIT- 3 Introduction to C++

Language Reference Manual

Introduction to Programming Using Java (98-388)

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

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

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

PieNum Language Reference Manual

Sprite an animation manipulation language Language Reference Manual

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. Overview. Objectives. Teaching Tips. Quick Quizzes. Class Discussion Topics

Creating a C++ Program

Language Reference Manual

The SPL Programming Language Reference Manual

Full file at

Review of the C Programming Language for Principles of Operating Systems

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

MATLIP: MATLAB-Like Language for Image Processing

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

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

IC Language Specification

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

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

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

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

SSOL Language Reference Manual

Twister: Language Reference Manual

The PCAT Programming Language Reference Manual

Visual C# Instructor s Manual Table of Contents

LECTURE 02 INTRODUCTION TO C++

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

Decaf Language Reference Manual

L-System Fractal Generator: Language Reference Manual

Lecture 2 Tao Wang 1

GOLD Language Reference Manual

Chapter 2: Using Data

Full file at

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

XQ: An XML Query Language Language Reference Manual

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

Object oriented programming. Instructor: Masoud Asghari Web page: Ch: 3

Chapter 2: Basic Elements of C++

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

2.1. Chapter 2: Parts of a C++ Program. Parts of a C++ Program. Introduction to C++ Parts of a C++ Program

Language Fundamentals Summary

Pace University. Fundamental Concepts of CS121 1

3. Except for strings, double quotes, identifiers, and keywords, C++ ignores all white space.

YOLOP Language Reference Manual

EZ- ASCII: Language Reference Manual

Java Notes. 10th ICSE. Saravanan Ganesh

BASIC ELEMENTS OF A COMPUTER PROGRAM

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

Review of the C Programming Language

VLC : Language Reference Manual

Introduction to C# Applications

Variables, Constants, and Data Types

CS313D: ADVANCED PROGRAMMING LANGUAGE

CLIP - A Crytographic Language with Irritating Parentheses

Section 2: Introduction to Java. Historical note

FRAC: Language Reference Manual

C++ Programming: From Problem Analysis to Program Design, Third Edition

6.096 Introduction to C++ January (IAP) 2009

ASML Language Reference Manual

Cellular Automata Language (CAL) Language Reference Manual

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

GeoCode Language Reference Manual

Objectives. In this chapter, you will:

BITG 1233: Introduction to C++

Reference Grammar Meta-notation: hfooi means foo is a nonterminal. foo (in bold font) means that foo is a terminal i.e., a token or a part of a token.

Chapter 2 Working with Data Types and Operators

GBIL: Generic Binary Instrumentation Language. Language Reference Manual. By: Andrew Calvano. COMS W4115 Fall 2015 CVN

CMAT Language - Language Reference Manual COMS 4115

SMURF Language Reference Manual Serial MUsic Represented as Functions

SFPL Reference Manual

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

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

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

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

A First Look at ML. Chapter Five Modern Programming Languages, 2nd ed. 1

JAVA Programming Fundamentals

DEPARTMENT OF MATHS, MJ COLLEGE

X Language Definition

String Computation Program

SCoLang - Language Reference Manual

Key Differences Between Python and Java

Transcription:

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 computer language based on both Java and Matlab. Warhol s types, syntax, and semantics are meant to help the user easily manipulate images. Images are uploaded from files and translated into our main primitive type, matrices. Our primitive types are designed to store pixel data. Warhol allows frequent writes, reads, and computes of pixels. Built-in functions are provided to compute commonly used image algorithms while also giving users freedom to implement functions. The Warhol Library contains methods to facilitate declarative programming. Library functions provide standard implementations of image editing task that can be performed on matrix types. Lexical Conventions Tokens consists of identifiers, constants, separators, keywords, strings, and expression operators. Comments and tabs are completely ignored. Blanks are new lines are used to separate tokens. Comments Comments are denoted by opening and closing dollar signs. Example 1: $ this is my code $ Example 2: $ this is also my code $ and this as well $ Identifiers Identifiers are a sequence of at least one character and a number. The first character of an identifier must be alphabetic. Identifiers are case sensitive and cannot begin with an uppercase letter. Longest string search is used to determine if an identifier is identical to a key word. Keywords int mat

bool else while continue void fun if for break sizeof null char Constants Integers Integers constants are sequence of at least one digit. Characters Character constants are one character enclosed with single quotes. Two character character constants are allowed only if the first character is a backslash. Characters are treated as integers. Example: \n, a, \t, 0 Strings Strings are implemented as a matrix of characters. The matrix is always the exact length of the string. Termination of string is determined by bounds of the matrix containing a string's characters. Types Matrix Matrices are 1, 2 and 3 dimensional arrays that can contain other objects defined in the Warhol language. Functions Functions are procedures that return void or methods that return other objects. Integers Integer types are declared using keyword int Characters Characters are chosen from ASCII set and declared using keyword char. Characters can also be read as a number. Boolean Booleans are declared using keyword bool. Booleans are stored and equivalent to integers equal to 0 for false and greater than 0 for true. Scope

No variables of the same name, Ocaml style in the sense of immediate globalization (by C definition, automatic) Conversions Characters and Integers Certain operators perform implicit conversions from one type to another such as characters. Characters can be used the same as integers. Expressions Primary Expressions Primary expressions are literals and names. Primary expressions involving subscripting and function calls group left to right. An identifier is a primary expression. Its type is specified by its declaration (ex: matrix, function) A decimal or character constant is a primary expression. Its type is int. A string is a primary expression. Its type is matrix of chars. ( expression ) A parenthesized expression is a primary expression. Its type and value are identical to the expression inside the parentheses. primary-expression [ expression ] A primary expression followed by an expression in square brackets is a subscript and is a primary expression. primary-expression ( expression-list (optional) ) A function call is a primary expression that is immediately followed by parentheses containing the list of its arguments. It is of type function returning... and the result of the function call is of type.... Any arguments of type char are converted to type int before the call. Parameters are passed by reference. Equality Operators Is-equal-to Is-not-equal-to expression_a == expression_b expression_a!= expression_b Relational Operators The operators <, >, <=, and >= all yield 0 if the specified relation is false, and 1 if it is true. Is-less-than expression_a < expression_b Is-greater-than

expression_a > expression_b Is-less-than-or-equal-to expression_a <= expression_b Is-greater-than-or-equal-to expression_a >= expression_b Math Operators If both operands are int or char, the result is int. If one is int or char and the other is mat, then the result is mat. If both operands are mat, then the result is mat. No other combinations are allowed. Addition expression_a + expression_b The result is the sum of the expressions. Subtraction expression_a - expression_b The result is the difference of the expressions. Division expression_a / expression_b The binary / operator signifies division. Multiplication expression_a * expression_b The binary * operator signifies multiplication. Unary Operators Any expression with a unary operator is read from left to right.! expression This negation operator returns 1 if the value of the expression is 0, 0 if the value of the expression is non-zero. The type of the result is bool. This operator is only applicable to bools. - expression The result is the negative of the expression. This operator is only applicable to ints and chars. sizeof expression Returns the size (bytes) of the operand. Logical Operators expression && expression The && ( and ) operator returns 1 if both its operands are non-zero. Otherwise, it returns 0. expression expression The ( or ) operator returns 1 if either of its operands is non-zero, and 0 otherwise. Assignment Operator value = expression

value. The value of the expression replaces that of the object referred to by the Declaration Declarations in Warhol are used to establish particular types. Declaration In Warhol there is one declaration max, per semicolon. mat name = [x1 x2 x3; y1 y2 y3; z1 z2 z3]; The scope of declaration binds the declaration to some declarator for later function application. Declarators declarator() is a function declaration that applies a builtin function to the expression declaration statement Statements For example, mat in Warhol, is an example of how type declaration in Warhol is done via declarators in the declaration statement. Expressions In Warhol there is one expression statement max, per semicolon. Expression statements look like: Compound Statement form expression ; In Warhol, a compound statement consists of a list of statements where each statement ends in a semicolon. Compound statements look like: Conditional Statement expression1 ; expression2 ; expression3 ;

In Warhol, a conditional statement consists of a conditional keyword, such as if, followed by an expression, in parentheses and an expression statement. Conditional statements look like: keyword (expression ) statement; Break Continue Return The break identifier terminates loops so it must be used in the context of a loop. Break statements look like: - break; The continue identifier skips one iteration of a loop so it must be used in the context of a loop. Continue statements look like: - continue; The return statement returns the result of a function to the caller of the function. Return statements look like: - return; Function Declaration type fun nameoffunction (Declarator1, Declarator2, ) { <statement1> <statement 2> return result; } Parameters

Default scope for any variable is local. If declared in the parameters of a function, the scope is the length of the function. All parameters are passed by value, leaving the original object passed into the function unchanged. Upload Write Print Built-in Functions Takes in a image file format and returns an image object - string - name of the image file - Image - the image uploaded Takes an image object and writes it to a file - Image - file to be written to file - String - name of file - Void - the function returns void Takes an image object and displays - Image - file to be written to file - Void - the function returns void Standard Library RevX() Takes a matrix and reverses the given matrix along the columns - Mat - the original matrix - Mat - the same matrix with the columns reversed RevY() Takes a matrix and reverses the given matrix along the rows - Mat - the original matrix - Mat - the same matrix with the rows reversed Concat() Takes a matrix or image and concatenates the second matrix to the intended row/column. Types concatenating must match

- Mat/image - the original matrix or image - Mat/image - the matrix or image to be concatenated - Direction - enumeration type of LEFT, BOTTOM, RIGHT, TOP, to choose where to concatenate - Mat - new concatenated matrices in one Filter() Takes an image and filters the image using a convolution matrix - Image - the image to be filtered - Mat - the convolution matrix - Image - the filtered copy of the image Blur() Takes an image and blurs the image using basic sharpen matrix multiplication - Image - the image to be sharpened - Image - the blurred copy of the image Sharpen() Takes an image and sharpens the image using basic sharpen matrix multiplication - Image - the image to be sharpened - Image - the sharpened copy of the image