Decaf Language Reference Manual
|
|
- Owen George
- 5 years ago
- Views:
Transcription
1 Decaf Language Reference Manual C. R. Ramakrishnan Department of Computer Science SUNY at Stony Brook Stony Brook, NY February 12, 2012 Decaf is a small object oriented language with arrays, overloading, inheritance, and static method and field resolution. It is inspired by the Java tm programming language, and inherits many features of Java. This language was designed for use in Programming Languages and Compilers courses. It is small enough that a complete compiler/interpreter can be built for it in a single semester. Nevertheless, it has sufficiently rich set of features for writing a large set of object-oriented programs. This manual outlines the syntax and semantics of the language constructs in Decaf. The syntax is described in Extended Backus-Naur Form (EBNF) notation. In EBNF, which combines regularexpression-like notation with grammars, x stands for a sequence of zero or more x s; x + stands for a sequence of one or more x s; (x y) stands for choice between x and y; and x? stands an optional occurrence (i.e., zero or one) of x. In the following, symbols in bold face represent reserved words and special characters: i.e., tokens with unique lexemes, such as while. Symbols in italics are either nonterminal grammar symbols, or terminal symbols with attributes, such as int const. 1 Lexical Issues Decaf is case-sensitive; for example, for and For are treated as distinct lexical entities. White Space and Comments Whitespace (blanks, newlines and tabs) serve to separate tokens; otherwise they are ignored. Whitespace may not appear within any token except a string constant (see below). Decaf supports two styles of comments: Multi-line (C-style) comments that begin with /* and end with */. These comments may not be nested. Single-line comments that start with // and terminate at the end of line. Comments may appear wherever a whitespace may appear. 1
2 Reserved words The following are reserved words. boolean break continue class do else extends false float for if int new null private public return static super this true void while Constants There are three types of constants supported by Decaf: integer, floating point and string constants. Integer constants are made up of one or more digits, each digit ranging from 0 thru 9. Floating point constants are of two kinds. Floating point constants of the first kind have of a decimal point (. ), and a sequence of one or more digits on either side of it (e.g., ). Floating point constants of the second kind have a mantissa and exponent separated by an exponent symbol, which is a lower-case or upper-case e (i.e. e or E ). The mantissa is either an integer constant, or a floating point constant of the first kind. The exponent is an integer, optionally prefixed with a + or - sign. Examples of floating point constants of the second kind are: 1.61E-19, 6.022E23, 3.0E+8, 2e32, 3e+8, and 2e-16. String constants begin and end with a double quote ("). If the string itself contains a double quote, it is escaped with a backslash (\) as in the example string: "\"What?\" she exclaimed.". Escape sequences, such as \n and \t are used to place special characters such as newlines and tabs in a string. If the string contains a backslash, that is escaped too (e.g., "The computer simply responded with \"A:\\>\""). Strings must be contained within a single line. Decaf does not support character constants. Integer, floating point and string constants are denoted in the syntax descriptions below, by int const, float const and string const respectively. Identifiers Letters denote the upper and lower case elements of the English alphabet (a thru z and A thru Z). An identifier is a sequence of letters, digits and underscore ( ), starting with a letter, that is not one of the reserved words. Identifiers are denoted by the symbol id. 2 Declarations A Decaf program is a sequence of class declarations. program ::= class decl Class Declarations A class declaration associates a set of fields, methods and constructors to a class name. Its syntax is: 2
3 class decl ::= class id (extends id)? { class body decl + class body decl ::= field decl method decl constructor decl Each class declaration (e.g., class foo...) creates a new class with the given name (e.g., foo). The extends option is used to specify a superclass, from which the current class inherits its fields and methods. Field declarations specify the fields that objects in this class will have; method declarations specify the methods that can be used on objects in this class; and constructor declarations are used to specify any initialization that needs to be done when a new object in this class is created. Fields The syntax of field declarations in Decaf is: field decl ::= modifier var decl modifier ::= (public private)? (static)? var decl ::= type variables ; type ::= int float boolean id variables ::= variable (, variable) variable ::= id ([ ]) Field declarations may be prefixed with modifiers as specified by the above syntax. A public field is a variable that can be accessed from methods defined in any other class. A private field is variable that can be accessed only from methods defined in the same class. If a field is not explicitly specified as private or public, it is assumed to be private. Fields that are declared static are called class variables; fields that are not declared static are called instance variables. Each instance of a class gets its own private copy of all instance variables declared in the class. However, all instance of a class share a single copy of the class variables declared in the class. A field may be one of the predefined types (int, float, boolean) or it may be an object in a user-defined class. Multiple fields, all of same type, may be declared in a single statement; in this case, field names are separated by commas. Array fields are defined by specifying [] after the field name. The number of [] s specify the number of dimensions of the array. Note that, as in Java, this only declares the array, and does not create one, i.e., allocate space for it. The array will be created, dynamically, using the new construct, described later in this manual. Inheritance: All objects of a class c contain instance fields defined in c as well as instance fields defined in all superclasses of c. A class may contain a new field whose name is identical to one in 3
4 a superclass. However, only one field of a given name can be defined in a class, irrespective of the types. Methods and Constructors Methods in a class encapsulate procedures for manipulating objects belonging to a class. Constructors in a class are used to initialize objects of the class whenever they are created. The syntax of method and constructor declarations is as follows: method decl ::= modifier (type void) id ( formals? ) block constructor decl ::= modifier id ( formals? ) block formals ::= formal param (, formal param) formal param ::= type variable The public and private modifiers are used to specify whether the given method can be accessed from methods in other classes. Methods declared static are called class methods and those not declared static are called instance methods. Instance methods always operate on a specific instance of the class, whereas class methods operate on the class as a whole and not on individual instances. A method that returns nothing (i.e., a procedure) has a return type of void. Methods may take a list of arguments, the name and type of which are given by a list of formal parameters. There may be multiple methods of the same name defined within a class, as long as they can be distinguished on the basis of the number or types of parameters. The name of a constructor must be same as that of the parent class. Constructors may also take a list of arguments, again specified as by the list of formal parameters. The body of a method or constructor is specified by a block of statements, described below. 3 Statements Decaf supports a small but expressive set of control primitives to specify procedures for manipulating the objects. The syntax of Decaf statements is: block ::= { stmt stmt ::= if ( expr ) stmt (else stmt)? while ( expr ) stmt for ( stmt expr? ; expr? ; stmt expr? ) stmt return expr? ; stmt expr ; break ; continue ; block var decl ; A block of statements is comprised of a (possibly empty) set of declarations for variables local to that block, followed by a sequence of statements. If statement: An if-statement of the form if ( expr ) stmt evaluates the boolean expression expr; if the expression evaluates to true, then the statement stmt is executed. When the optional 4
5 else part is present, of the form else stmt, then the statement stmt is executed if the expression evaluates to false. While statement: A while-statement of the form while ( expr ) stmt loops, evaluating expr first and executing stmt as long as expr is true. The loop is exited when expr evaluates to false. For statement: A for-statement of the form for ( s 1 ; e 2 ; s 3 ) stmt 4 has four components: an initializer s 1, which is evaluated on entry to the statement; the boolean expression e 2, which is evaluated at the beginning of each iteration through the loop; an update part s 3, which is executed at the end of each iteration through the loop; and statement stmt 4, which is executed as long as e 2 evaluates to true. The loop is exited when e 2 evaluates to false. Return statement: A return statement signifies the end of control in a method. The expression expr is evaluated and is returned to the caller of the method. Thus the declared return type of the method must be compatible with the type of expr. If the return type of the method is void, then the expr part of the return statement is omitted. Expression statement: Certain expressions, such as assignments and post-increment operations, denoted by stmt expr, can be stand-alone statements. See Section 4 for syntax of stmt expr. Block statement: A block of statements can themselves be used wherever a statement is used. When a block statement is executed, the local variables declared in that block are freshly created, and the sequence of statements in that block are executed in order. Empty statement: An empty statement is specified simply by ;. It has no effect on execution. 4 Expressions Objects and their values are manipluated using a variety of expressions. The simplest form of expressions are literal constants: literal ::= int const float const string const null true false In the following, the nonterminal grammar symbol expr is used to denote the set of all expressions allowed in Decaf. Literal constants, creation of new instances of objects, access of object fields and arrays, and method invocation are among the basic set of expressions used in Decaf, called primary expressions, the syntax of which is given below: 5
6 primary ::= literal this super ( expr ) new id ( arguments? ) lhs method invocation arguments ::= expr (, expr ) lhs ::= field access array access field access ::= primary. id id array access ::= primary [ expr ] method invocation ::= field access ( arguments? ) The reserved word this is used to represent the current object, i.e., the object on which the method containing the current expression is applied. The reserved word super is used to explicitly access fields or methods in the superclass; this construct is primarily used when names alone are insufficient to distinguish fields and methods in a class from those of its superclass. A new object is created using the reserved word new. The arguments supplied with the name of the class correspond to parameters of the constructor to be used to initialize the new object. An lhs expression is an expression that can occur on the left hand side of an assignment: either referring to a field of an object, or to an element of an array. A field in an object of class c can be accessed by simply using the name of the field, provided it is being accessed from a method defined in class c. If there are multiple objects of class c, or if the field is accessed from a method defined in a different class, the field is specified using the notation object.field. A method invocation takes the form object.method(args). If a method invocation does not explicitly specify an object, then this is assumed as the default object. The syntax of array access resembles that of array accesses in C: array[index]. Multidimensional arrays are accessed by specifying a sequence of indices, each index enclosed in square brackets. An array is assumed to be created before it is accessed. Other expressions in Decaf are defined using the primary expressions described above. 6
7 expr ::= primary assign new array expr arith op expr expr bool op expr unary op expr assign ::= lhs = expr lhs lhs lhs lhs new array ::= new type ([ expr ]) + ([ ]) arith op {+,, *, / bool op { &&,, ==,!=, <, >, <=, >= unary op {+,,! An assignment expression can be an explicit assignment, specified using the assignment operator =, or an implicit assignment, specified by the pre- or post- increment (++) or decrement ( ) operators. An array is created with the new operator by specifying the type of array and the sizes along its different dimensions. The sizes are, in general, integer expressions (not just integer constants). Decaf provides a set of commonly used arithmetic and relational operators. Binary arithmetic operators include addition (+), subtraction ( ), multiplication (*) and division (/), which operate on integers or floating point numbers. Boolean operators include: equality and disequality operations (==,!=) that can be applied, in addition to integer and floating point expressions, to objects of any type, as long as both objects being compared are of the same type; common relational operations ( >, <, >= and <= ) on integer and floating point expressions; and logical operations conjunction (&&) and disjunction ( ). Unary operators include unary plus (+), minus ( ) that operates on integer and floating point expressions and negation (!) that operates on boolean expressions. The explicit assignment (=) associates to the right. Relational operators ( >, <, >= and <=) are nonassociative. All other binary operators associate to the left. Hence, the expression a + b + c + d is treated as ((a + b) + c) + d, while the expression a = b = c = d is treated as a = (b = (c = d)). The precedence of the operators is defined in Table 1 which lists the operators from highest to lowest precedence. Finally, statement expressions are those, such as assignments and method invocations, that can occur as stand-alone statements. Their syntax is defined by the following rule: stmt expr ::= assign method invocation 7
8 highest precedence! *, / +, <, >, <=, >= ==,!= && lowest precedence = Table 1: Precedence of binary operators in Decaf 5 Standard Objects and Methods Decaf provides two standard objects: Out which represents the standard output file (the console) and In which represents the standard input file (the keyboard). The methods that can be used on these objects are: 1. print(expr): This is an overloaded method, which can take objects of any primitive type (integers, floating point numbers and booleans) as well as string constants, and writes their values to the given file. The method is usually applied to Out and returns void. 2. scan int(): This method, usually applied to In, reads a stream of characters from file that represent an integer and returns the corresponding integer value. 3. scan float(): Similar to scan int(), this method is used to read a floating point value from the given file. Entry Point A class whose name is same as the filename of the program is the main object of the program. For instance, if the program is in file foo.decaf, then class foo is the main class in the program. A static, public, parameterless method called main in class foo is the entry point of the program in foo.decaf. That is, when invoked from the command line, main() will be the first method invoked from the operating system. 6 Sample Decaf Programs Following are four sample programs of varying complexity written in Decaf. 8
9 hello world.decaf This program prints "Hello World!" on the console and exits. class hello_world{ public static void main() { Out.print("Hello World!\n"); nrfib.decaf The following program computes and prints the n th Fibonacci number, given n as the input. The Fibonacci number is computed using a nonrecursive procedure. class nrfib{ public static void main() { int n, i, fn, fn_prev; n = In.scan_int(); fn = 1; fn_1 = 0; for(i=1; i<n; i=i+1) { fn = fn_prev + fn; fn_prev = fn - fn_prev; Out.print("Fib = "); Out.print(fn); Out.print("\n"); 9
10 rfib.decaf The following program computes and prints the n th Fibonacci number, given n as the input. The Fibonacci number is computed using a recursive procedure. class rfib{ static int fib(int n) { if (n <= 2) return 1; else return fib(n-1) + fib(n-2); public static void main() { int n; n = In.scan_int(); Out.print("Fib = "); Out.print(fib(n)); Out.print("\n"); 10
11 IntList.decaf This program implements an abstract datatype of (singly-linked) list with integer elements, with operations of insertion, search and length. class IntList{ int value; IntList next; public static IntList create_list(int v) { IntList new_element; new_element = new IntList(); new_element.value = v; new_element.next = null; return new_element; public IntList insert(int v) { IntList new_element; new_element = create_list(v); new_element.next = this; return new_element; public boolean search(int v) { if (this.value == v) { /* head of list matches */ return true; else /* not at head, so search rest of list */ if (next == null) { /* end of list, so search fails */ return false; else /* search rest of the list */ return next.search(v); public int length() { if (next == null) return 1; else return 1 + next.length(); 11
12 Acknowledgements Decaf was first used as the source language for the Compiler Design course in Fall 96. Many thanks are due to those students who gracefully put up with the inconsistencies of the first version. Based on that version of Decaf, R. Sekar (then of Iowa State University) defined Espresso, also used in a Compilers course; his design was used to remove some irregularities from Decaf. Kevin Kreeger (Fall 96 class) also suggested several simplifications of Decaf s grammar that have been included in the current version. Many thanks are due also to Tord Johnson (Fall 98 class) for finding and reporting many errors in an early draft of this manual. 12
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
More informationLexical 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
More informationLexical 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
More informationCA4003 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.
More informationDecaf 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
More informationThe 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
More informationThe 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
More informationIC 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
More informationIPCoreL. 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
More informationJME 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.
More informationLanguage Reference Manual
Espresso Language Reference Manual 10.06.2016 Rohit Gunurath, rg2997 Somdeep Dey, sd2988 Jianfeng Qian, jq2252 Oliver Willens, oyw2103 1 Table of Contents Table of Contents 1 Overview 3 Types 4 Primitive
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
More informationUNIT- 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
More informationThe Decaf Language. 1 Lexical considerations
The Decaf Language In this course, we will write a compiler for a simple object-oriented programming language called Decaf. Decaf is a strongly-typed, object-oriented language with support for inheritance
More informationThe Decaf language 1
The Decaf language 1 In this course, we will write a compiler for a simple object-oriented programming language called Decaf. Decaf is a strongly-typed, object-oriented language with support for inheritance
More informationReference 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.
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2002 Handout 7 Espresso Language Definition Wednesday, September 4 The project for the 18-unit
More informationReference 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.
Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2002 Handout 6 Decaf Language Definition Wednesday, September 4 The project for the 12-unit flavor
More informationLanguage 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
More informationLanguage Reference Manual
TAPE: A File Handling Language Language Reference Manual Tianhua Fang (tf2377) Alexander Sato (as4628) Priscilla Wang (pyw2102) Edwin Chan (cc3919) Programming Languages and Translators COMSW 4115 Fall
More informationLanguage 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
More informationFull 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
More informationA 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
More informationProgramming Lecture 3
Programming Lecture 3 Expressions (Chapter 3) Primitive types Aside: Context Free Grammars Constants, variables Identifiers Variable declarations Arithmetic expressions Operator precedence Assignment statements
More informationTypescript 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
More informationJava+- Language Reference Manual
Fall 2016 COMS4115 Programming Languages & Translators Java+- Language Reference Manual Authors Ashley Daguanno (ad3079) - Manager Anna Wen (aw2802) - Tester Tin Nilar Hlaing (th2520) - Systems Architect
More informationSprite 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
More informationASML 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
More informationJava Notes. 10th ICSE. Saravanan Ganesh
Java Notes 10th ICSE Saravanan Ganesh 13 Java Character Set Character set is a set of valid characters that a language can recognise A character represents any letter, digit or any other sign Java uses
More informationQUark Language Reference Manual
QUark Language Reference Manual Daria Jung (djj2115), Jamis Johnson (jmj2180), Jim Fan (lf2422), Parthiban Loganathan (pl2487) Introduction This is the reference manual for QUark, a high level language
More informationObjectives. 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
More informationChapter 2: Basic Elements of C++
Chapter 2: Basic Elements of C++ 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
More informationChapter 2: Basic Elements of C++ Objectives. Objectives (cont d.) A C++ Program. Introduction
Chapter 2: Basic Elements of C++ C++ Programming: From Problem Analysis to Program Design, Fifth Edition 1 Objectives In this chapter, you will: Become familiar with functions, special symbols, and identifiers
More informationFRAC: 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
More informationSMURF 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
More informationC 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,
More information3. Java - Language Constructs I
Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks
More informationBASIC 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
More informationGraphQuil 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
More informationegrapher 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
More informationCompilers. Compiler Construction Tutorial The Front-end
Compilers Compiler Construction Tutorial The Front-end Salahaddin University College of Engineering Software Engineering Department 2011-2012 Amanj Sherwany http://www.amanj.me/wiki/doku.php?id=teaching:su:compilers
More informationARG! 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
More informationStandard 11. Lesson 9. Introduction to C++( Up to Operators) 2. List any two benefits of learning C++?(Any two points)
Standard 11 Lesson 9 Introduction to C++( Up to Operators) 2MARKS 1. Why C++ is called hybrid language? C++ supports both procedural and Object Oriented Programming paradigms. Thus, C++ is called as a
More informationCS143 Handout 03 Summer 2012 June 27, 2012 Decaf Specification
CS143 Handout 03 Summer 2012 June 27, 2012 Decaf Specification Written by Julie Zelenski and updated by Jerry Cain and Keith Schwarz. In this course, we will write a compiler for a simple object oriented
More informationThe 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
More informationThe MaSH Programming Language At the Statements Level
The MaSH Programming Language At the Statements Level Andrew Rock School of Information and Communication Technology Griffith University Nathan, Queensland, 4111, Australia a.rock@griffith.edu.au June
More informationCPS 506 Comparative Programming Languages. Syntax Specification
CPS 506 Comparative Programming Languages Syntax Specification Compiling Process Steps Program Lexical Analysis Convert characters into a stream of tokens Lexical Analysis Syntactic Analysis Send tokens
More informationCS /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
More informationFeatures of C. Portable Procedural / Modular Structured Language Statically typed Middle level language
1 History C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell Labs. C was originally first implemented on the DEC
More informationYOLOP 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
More informationCHIL 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
More informationVisual C# Instructor s Manual Table of Contents
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
More informationContents. 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
More informationThis book is licensed under a Creative Commons Attribution 3.0 License
6. Syntax Learning objectives: syntax and semantics syntax diagrams and EBNF describe context-free grammars terminal and nonterminal symbols productions definition of EBNF by itself parse tree grammars
More informationIntroduction 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;
More information\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
More informationEDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION
EDIABAS Electronic Diagnostic Basic System BEST/2 LANGUAGE DESCRIPTION VERSION 6b Copyright BMW AG, created by Softing AG BEST2SPC.DOC CONTENTS CONTENTS...2 1. INTRODUCTION TO BEST/2...5 2. TEXT CONVENTIONS...6
More informationGAWK Language Reference Manual
GAWK Language Reference Manual Albert Cui, Karen Nan, Mei-Vern Then, & Michael Raimi So good, you re gonna GAWK. 1.0 Introduction This manual describes the GAWK language and is meant to be used as a reliable
More informationMirage. 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
More informationUnit-II Programming and Problem Solving (BE1/4 CSE-2)
Unit-II Programming and Problem Solving (BE1/4 CSE-2) Problem Solving: Algorithm: It is a part of the plan for the computer program. An algorithm is an effective procedure for solving a problem in a finite
More informationPetros: 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...................................................
More informationCSCI 1061U Programming Workshop 2. C++ Basics
CSCI 1061U Programming Workshop 2 C++ Basics 1 Learning Objectives Introduction to C++ Origins, Object-Oriented Programming, Terms Variables, Expressions, and Assignment Statements Console Input/Output
More informationChapter 3. Describing Syntax and Semantics
Chapter 3 Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings of Programs:
More informationChapter 1 Summary. Chapter 2 Summary. end of a string, in which case the string can span multiple lines.
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
More informationMATVEC: 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
More informationFundamental 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
More informationPrinciples of Programming Languages COMP251: Syntax and Grammars
Principles of Programming Languages COMP251: Syntax and Grammars Prof. Dekai Wu Department of Computer Science and Engineering The Hong Kong University of Science and Technology Hong Kong, China Fall 2007
More informationObject oriented programming. Instructor: Masoud Asghari Web page: Ch: 3
Object oriented programming Instructor: Masoud Asghari Web page: http://www.masses.ir/lectures/oops2017sut Ch: 3 1 In this slide We follow: https://docs.oracle.com/javase/tutorial/index.html Trail: Learning
More informationDaMPL. 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
More informationCS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University
CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can
More informationCSC Web Programming. Introduction to JavaScript
CSC 242 - Web Programming Introduction to JavaScript JavaScript JavaScript is a client-side scripting language the code is executed by the web browser JavaScript is an embedded language it relies on its
More informationCSc 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
More informationBasics 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
More informationC++ Programming: From Problem Analysis to Program Design, Third Edition
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine
More informationC++ 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
More informationLexical Analysis. Lexical analysis is the first phase of compilation: The file is converted from ASCII to tokens. It must be fast!
Lexical Analysis Lexical analysis is the first phase of compilation: The file is converted from ASCII to tokens. It must be fast! Compiler Passes Analysis of input program (front-end) character stream
More informationGOLD Language Reference Manual
GOLD Language Reference Manual Language Guru: Timothy E. Chung (tec2123) System Architect: Aidan Rivera (ar3441) Manager: Zeke Reyna (eer2138) Tester: Dennis Guzman (drg2156) October 16th, 2017 1 Introduction
More informationGBIL: Generic Binary Instrumentation Language. Language Reference Manual. By: Andrew Calvano. COMS W4115 Fall 2015 CVN
GBIL: Generic Binary Instrumentation Language Language Reference Manual By: Andrew Calvano COMS W4115 Fall 2015 CVN Table of Contents 1) Introduction 2) Lexical Conventions 1. Tokens 2. Whitespace 3. Comments
More informationChapter 2 Basic Elements of C++
C++ Programming: From Problem Analysis to Program Design, Fifth Edition 2-1 Chapter 2 Basic Elements of C++ At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class Discussion
More informationDifferentiate Between Keywords and Identifiers
History of C? Why we use C programming language Martin Richards developed a high-level computer language called BCPL in the year 1967. The intention was to develop a language for writing an operating system(os)
More informationAbsolute C++ Walter Savitch
Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents
More informationUNIT - 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
More informationCrayon (.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
More informationThese are reserved words of the C language. For example int, float, if, else, for, while etc.
Tokens in C Keywords These are reserved words of the C language. For example int, float, if, else, for, while etc. Identifiers An Identifier is a sequence of letters and digits, but must start with a letter.
More informationMore Assigned Reading and Exercises on Syntax (for Exam 2)
More Assigned Reading and Exercises on Syntax (for Exam 2) 1. Read sections 2.3 (Lexical Syntax) and 2.4 (Context-Free Grammars) on pp. 33 41 of Sethi. 2. Read section 2.6 (Variants of Grammars) on pp.
More informationObjectives. 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
More informationJava 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,
More informationProgramming with C++ as a Second Language
Programming with C++ as a Second Language Week 2 Overview of C++ CSE/ICS 45C Patricia Lee, PhD Chapter 1 C++ Basics Copyright 2016 Pearson, Inc. All rights reserved. Learning Objectives Introduction to
More informationVENTURE. 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
More informationCOMP519 Web Programming Lecture 11: JavaScript (Part 2) Handouts
COMP519 Web Programming Lecture 11: JavaScript (Part 2) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool
More informationSSOL 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...............................................
More informationSPARK-PL: Introduction
Alexey Solovyev Abstract All basic elements of SPARK-PL are introduced. Table of Contents 1. Introduction to SPARK-PL... 1 2. Alphabet of SPARK-PL... 3 3. Types and variables... 3 4. SPARK-PL basic commands...
More informationOperators. Java operators are classified into three categories:
Operators Operators are symbols that perform arithmetic and logical operations on operands and provide a meaningful result. Operands are data values (variables or constants) which are involved in operations.
More informationChapter 2: Using Data
Chapter 2: Using Data TRUE/FALSE 1. A variable can hold more than one value at a time. F PTS: 1 REF: 52 2. The legal integer values are -2 31 through 2 31-1. These are the highest and lowest values that
More informationJFlat Reference Manual
JFlat Reference Manual Java, but worse Project Manager: David Watkins djw2146 System Architect: Emily Chen ec2805 Language Guru: Phillip Schiffrin pjs2186 Tester & Verifier: Khaled Atef kaa2168 Contents
More informationGridLang: 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
More informationCOMS 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
More informationTED Language Reference Manual
1 TED Language Reference Manual Theodore Ahlfeld(twa2108), Konstantin Itskov(koi2104) Matthew Haigh(mlh2196), Gideon Mendels(gm2597) Preface 1. Lexical Elements 1.1 Identifiers 1.2 Keywords 1.3 Constants
More informationIntroduction to C# Applications
1 2 3 Introduction to C# Applications OBJECTIVES To write simple C# applications To write statements that input and output data to the screen. To declare and use data of various types. To write decision-making
More informationThe 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..........................................
More informationFundamentals 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
More information