ARG! Language Reference Manual

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

DaMPL. Language Reference Manual. Henrique Grando

The Warhol Language Reference Manual

Language Reference Manual simplicity

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

Visual C# Instructor s Manual Table of Contents

Chapter 2: Using Data

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

1 Lexical Considerations

FRAC: Language Reference Manual

Lecture 2 Tao Wang 1

Sprite an animation manipulation language Language Reference Manual

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

Full file at

Language Reference Manual

Chapter 2: Introduction to C++

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

Typescript on LLVM Language Reference Manual

Fundamental of Programming (C)

Chapter 2 Working with Data Types and Operators

Lexical Considerations

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

Lexical Considerations

egrapher Language Reference Manual

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

The SPL Programming Language Reference Manual

JME Language Reference Manual

Fundamentals of Programming

Java Notes. 10th ICSE. Saravanan Ganesh

Introduction to Programming Using Java (98-388)

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

Basics of Java Programming

Chapter 2: Basic Elements of C++

Computational Expression

GraphQuil Language Reference Manual COMS W4115

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

LECTURE 02 INTRODUCTION TO C++

UNIT- 3 Introduction to C++

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

RTL Reference 1. JVM. 2. Lexical Conventions

4 Programming Fundamentals. Introduction to Programming 1 1

XQ: An XML Query Language Language Reference Manual

VLC : Language Reference Manual

Chapter 2. Lexical Elements & Operators

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

IC Language Specification

Getting started with Java

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

DEPARTMENT OF MATHS, MJ COLLEGE

Full file at

CSC Web Programming. Introduction to JavaScript

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

CSCI 2010 Principles of Computer Science. Data and Expressions 08/09/2013 CSCI

CS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University

Java Primer 1: Types, Classes and Operators

CS313D: ADVANCED PROGRAMMING LANGUAGE

The PCAT Programming Language Reference Manual

Petros: A Multi-purpose Text File Manipulation Language

Decaf Language Reference Manual

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

Basic Operations jgrasp debugger Writing Programs & Checkstyle

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

Sheets Language Reference Manual

COMS W4115 Programming Languages & Translators GIRAPHE. Language Reference Manual

Chapter 2 Elementary Programming

Chapter 2 Using Data. Instructor s Manual Table of Contents. At a Glance. A Guide to this Instructor s Manual:

Zheng-Liang Lu Java Programming 45 / 79

corgi Language Reference Manual COMS W4115

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

GOLD Language Reference Manual

JFlat Reference Manual

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

3. Java - Language Constructs I

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

CSc Introduction to Computing

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

The C++ Language. Arizona State University 1

Introduction to C# Applications

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

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

Java How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.

I Internal Examination Sept Class: - BCA I Subject: - Principles of Programming Lang. (BCA 104) MM: 40 Set: A Time: 1 ½ Hrs.

Language Reference Manual

Chapter 2: Using Data

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

Java+- Language Reference Manual

Key Differences Between Python and Java

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

Engineering Problem Solving with C++, Etter/Ingber

GeoCode Language Reference Manual

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

QUark Language Reference Manual

CHAPTER 3 BASIC INSTRUCTION OF C++

SSOL Language Reference Manual

Programming in C++ 6. Floating point data types

Full file at C How to Program, 6/e Multiple Choice Test Bank

SFPL Reference Manual

QUIZ. 1. Explain the meaning of the angle brackets in the declaration of v below:

Language Reference Manual

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

Transcription:

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 in its syntax, but is dynamically typed and fully type inferenced. The language focuses on making the coding simpler for users, and is especially good for scientific computing. It includes standard library functions for scientific computing and array manipulations, including easy sorting of array members. 2. Lexical Elements There are six types of lexemes in ARG - identifiers, keywords, operators, separators and whitespace. a. Identifiers Identifiers are tokens that refer to variable or function names. They always start with a letter and may have an underscore or digits in them. Uppercase and lowercase letters are distinguished. Identifiers must be unique for each variable within the same scope. b. Keywords These keywords cannot be used as identifiers. They include: if,else,return,while,stop,function c. Operators Operators are used for performing arithmetic operations, establishing precedence, casting and, in the case of the! operator, modifying the STOP keyword. -,+,*,/,(),!,unary-,sizeof,typeof,==,!=,<=,>=,(int), (char),(double),(bool),[<int>] d. Separators Separators are used to delimit code blocks, identifiers and statements. ARG includes the following separators: {,; Whitespace is also a separator, but not a token. e. Whitespace Whitespace is used to indicate separation between two tokens. It is ignored unless specified as part of a character array. It may or may not be used between operators and operands. Any extra whitespace is treated as one white space. f. Comments /*indicates the start of a comment and */indicates its end. Multi-line comments are supported. 1

3. Data Types There are two types of data structures - 1. Primitive a. Int These are 32-bit structures that will only hold numeric values in the range 2,147,483,648 to 2,147,483,647. b. Char These are 8-bit structures which can contain any member of the ASCII character set, including escaped characters. c. Double Double values are 64 bits and include 1 sign bit, 11 exponent bits and 52 significand bits. d. Boolean Booleans are 8 bits and represent a logical true or false. All types evaluate to true except for the explicit boolean false. 2. Derived a. Arrays Arrays are collections of objects of the same type, stored contiguously in memory. They are derived by appending the [<Int>]operator to an identifier, where <Int> is an integer specifying the array s size. 4. Literals a. Int Literal An Int literal can be any decimal number 0-9 and may be preceded by the unary -. b. Char Literal A character literal can be any ASCII character, delimited by single quotes. They correspond to Char arrays. c. String Literal A string literal can be any set of ASCII characters, delimited by double quotes. d. Double Literal A double literal represents numbers with fractional values. They may include either a decimal point with a fraction or an e followed by a signed integer. It can have a maximum value of 1e+63. Floats may be preceded by the unary - e. Boolean Literal Structures of this type may have one of two values: true or false. They are not strings. 5. Operators a. Unary sizeof 2

Returns the size of an object in memory, in bytes. typeof Returns the datatype of the objects. - Negation for Ints and Doubles Casting - (int), (char), (double), (bool)! The! operator may be appended to the STOP keyword to modify the level of nestedness from which STOP should break out of. [<Int>] Appended to the right of an identifier, specifies that the identifier should be an array of size <Int>. b. Binary Addition (+) Subtraction (-) Multiplication (*) Division (/) Less Than/equal to (<=) Greater Than/equal to (>=) Equals (==) Not equals (!=) c. Assignment (=) Operator Precedence a. Unary operators b. Multiplication, Division c. Addition, subtraction d. Relational operators (<=, >=, ==,!=) e. Assignment operator Operators at the same level are grouped left-to-right. 6. Program Structure a. Declarations Since ARG does automatic type-inferencing, the data type of a variable need not be specified. Declarations have the form: identifier = value. b. Statements i. Expression statements These are statements which evaluate to some result which can be assigned to a variable, tested for logical truth or thrown away. These generally include assignment statements or calls to functions. They are of the form: expression; 3

ii. Conditional statements Conditional statements evaluate the logical verity of an expression and branch execution on the basis of the evaluation. These statements may be of the form: if(<boolean-expression>)statement; if(<boolean-expression>)statementelsestatement; iii. Iteration statements Iterators are loops which run until a specified expression evaluates as true. Syntaxwhile(<boolean-expression>)statement; iv. return statement Return is used to return values from one function to its caller. It can be used to return zero or more values. Syntaxreturn; returnexpression; Compound statements in any block can be put inside curly braces, e.g. - { expression1; expression2; v. STOP! statement This statement is used to iteratively break out of code blocks. Each exclamation mark after the STOP! statement breaks out of one block. The program counter is placed at the point immediately following the last code block broken out of. vi. FUNCTION statement The FUNCTION keyword simply denotes the declaration of a new function. Minimally, it must be followed by an identifier, a left-paren, a right-paren and a curly-brace delimited code block. Optionally, arguments can be specified by placing comma-delimited identifiers within the parentheses. c. Scope In ARG, curly-braces delimit code blocks and scope. The global scope is itself a code block implicitly wrapped in curly-braces by the compiler. Identifiers declared in outer code blocks are accessible by inner code blocks, but the opposite is not true. 7. Example /*argv[]andargc[]areavailableasglobalvariables.*/ countto=argv[1]; /*AChar*/ attempts=argv[2]; /*AnInt*/ /*resultmaybeabooleanorachar.*/ result=counttochar(countto,attempts); 4

/*Anythingwhichisnotabooleanfalseistrue.*/ if(result==true){ /*Printresult,acharinthisinstancebutpossiblyanytype,asa string.*/ PRINT("%x\n",result); /*Exitbybreakingoutoftheprogramblock.*/ STOP!; /*Thisfunctionthatusesintegerstocountuptoacharacter.Itcan returnanytype*/ FUNCTIONcounttochar(countto,attempts){ /*Idiomatic(ARG!)presumesfailure.*/ result=false; i=0; WHILE(i<attempts){ IF(i==countto){ /*Setresult,previouslyaboolwiththeexplicitvaluefalse, toacharwiththeimplicitvaluetrue.*/ result=countto; /*Jumpoutoftheifblockandthewhileblock.Theuseoftwo exclamationmarksspecifiedtwolevelsofnestbreakout-ness.*/ STOP!!; i++; returnresult; 5