# COMP519 Web Programming Lecture 11: JavaScript (Part 2) Handouts

Size: px
Start display at page:

Transcription

1 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

2 Contents 1 Primitive Data Types Booleans Numbers Strings 2 Arrays Literals 3 Storing Values Variables Assignments Constants Determining the Type of a Value or Variable 4 Further Reading Ullrich Hustadt COMP519 Web Programming L11 1

3 Types Data Type / Datatype / Type A set of computer represented values together with a set of operations that can be performed on those values JavaScript distinguished four main types: boolean number string object booleans integers and floating-point numbers strings objects (including functions and arrays) Every value is of a particular type (or none) Ullrich Hustadt COMP519 Web Programming L11 2

4 Booleans Primitive Types Booleans JavaScript has a boolean datatype with constants true and false (case sensitive) JavaScript offers the following boolean operators && (conjunction) (disjunction)! (negation) The truth tables for the boolean operators are as follows: A B (A && B) true true B (true) true false B (false) false true A (false) false false A (false) A (! A) true false false true A B (A B) true true A (true) true false A (true) false true B (true) false false B (false) Ullrich Hustadt COMP519 Web Programming L11 3

5 Boolean Operators Primitive Types Booleans As in almost every programming language the operators && (conjunction) (disjunction)! (negation) are so-called short-circuit boolean operators: A boolean expression is evaluated (using inorder traversal) only as far as is necessary to determine the overall truth value of the expression ( true ( false &&! (! ( true && ( false true ))))) ( true && ( false &&! (! ( true && ( false true ))))) This means that && and are not commutative, that is, (A && B) is not the same as (B && A) often taken advantage of in programs ( denom!= 0) && ( num / denom > 10) Ullrich Hustadt COMP519 Web Programming L11 4

6 Primitive Types Numbers Integers and Floating-point Numbers The JavaScript datatype number covers both integer numbers floating-point numbers e19 2.4e-10 all numbers are stored as 64-bit floating-point numbers There are also some pre-defined number constants including Math.PI (case sensitive) NaN (case sensitive) not a number Infinity (case sensitive) infinity Ullrich Hustadt COMP519 Web Programming L11 5

7 Primitive Types Numbers Operators on Integers and Floating-point Numbers Arithmetic operators supported by JavaScript include +, -, * Addition, Subtraction, Multiplication / Division ** Exponentiation ++ Increment (+1) -- Decrement ( 1) The Math object provides a wide range of additional mathematical functions Math.abs(number) absolute value Math.ceil(number) round fractions up Math.floor(number) round fractions down Math.round(number) round fractions Math.log(number) natural logarithm Math.random() random number between 0 and 1 Math.sqrt(number) square root Ullrich Hustadt COMP519 Web Programming L11 6

8 Strings Primitive Types Strings JavaScript supports both single-quoted and double-quoted strings " This is a string " " true " This is also a string 519 The escape character \ can be used to include single quotes in single-quoted strings and double quotes in double-quoted strings: This isn \ t a " number " " We won t sing \" God Save the Queen.\" " The escape character \ also must be used to include \ in a string " This is a backslash \\" This is a backslash \\ Additional escape characters are available, but do not make much sense in the context of HTML \b (backspace) \f (form feed) \n (newline) \r (carriage return) \t (tab) Ullrich Hustadt COMP519 Web Programming L11 7

9 Strings Primitive Types Strings JavaScript uses + for string concatenation "519" // returns " " the + end // returns " theend " JavaScript supports multi-line strings document. writeln ("\ Your name is " + name + "\ and you are studying " + degree + "\ at " + university \ "); Ullrich Hustadt COMP519 Web Programming L11 8

10 String Operators Primitive Types Strings There are a range of additional string operators, for example: string.substr(start, [length]) Returns (up to) length characters of string beginning at start "university".substr(3,2) // returns "ve" (count starts at 0) string.indexof(str, [start]) Returns the index number at which str starts in string after start "university".indexof("i",3) // returns 7 (count starts at 0) string.match(regexp) Returns an array of matching substrings for the regular expression regexp in string "0ab1".match(/[^0-9]/) // returns ["a"] string.replace(regexp, str) Replaces occurrences of regexp in string by str "0ab1".replace(/[^0-9]/g,"c") // returns "0cc1" Ullrich Hustadt COMP519 Web Programming L11 9

11 Array Literals Arrays An array literal is a comma-separated list of values enclosed in square brackets [2,3,5,7,11] Each element of that list has an index position given by the number of other elements preceding it the first index position is 0 [2,3,5,7,11] The values in an array literal do not need to be of the same type [2, two,3," three ",1.1 e1, true ] The values in an array literal can include other array literals (nested array literal) [2,[3,5],[7,[11]]] Ullrich Hustadt COMP519 Web Programming L11 10

12 Arrays Operators on Array Literals It is possible to access an element of an array literal via its index position: arrayliteral[index] [2,3,5,7,11][1] // returns 3 For a nested array literal, it is possible to iterate this access operation [2,[3,5],[7,[11]]][1] // returns [3,5] [2,[3,5],[7,[11]]][1][0] // returns 3 The length operation returns the number of elements in an array literal: arrayliteral.length [2,3,5,7,11]. length // returns 5 We will discuss more operators in the context of array variables Ullrich Hustadt COMP519 Web Programming L11 11

13 Variables Storing Values Variables A JavaScript variable name may consist of letters, digits, the \$ symbol, and underscore, but cannot start with a digit JavaScript variable names are case sensitive Ullrich Hustadt COMP519 Web Programming L11 12

14 Variables Storing Values Variables Variables can be declared using one of the following statements: var variable1, variable2,... var variable1 = value1, variable2 = value2,... The second statement also initialises the variables Used inside a function definition, a declaration creates a local variable (only accessible within the function) Used outside a function definition, a declaration creates a global variable A variable can be inialised without a declaration by assigning a value to it: variable = value Both inside and outside a function definition, initialising an undeclared variable creates a global variable Note: A declaration does not specify the type of a variable only assigning a value of a certain type gives a variable a type Ullrich Hustadt COMP519 Web Programming L11 13

15 Variables Storing Values Variables In JavaScript, the use of the value of a variable that is neither declared nor initialised will result in a reference error A declared but uninitialised variable has the default value undefined and has no specific type myvar1 // reference error var myvar2 // myvar2 has value undefined var myvar3 = 5 // myvar3 has value 5 Ullrich Hustadt COMP519 Web Programming L11 14

16 Assignments Storing Values Assignments JavaScript uses the equality sign = for assignments student_ id = ; As in Java, this is an assignment expression The value of an assignment expression is the value assigned b = ( a = 0) + 1; // a has value 0, b has value 1 JavaScript supports most of the standard binary assignment operators: Binary assignment Equivalent assignment var += expr var = var + expr var -= expr var = var - expr var *= expr var = var * expr var /= expr var = var / expr var %= expr var = var % expr var **= expr var = var ** expr (not in MS IE) Ullrich Hustadt COMP519 Web Programming L11 15

17 Constants Storing Values Constants Some JavaScript dialects allow the definition of constants using const variable1 = value1, variable2 = value2,... defines one or more constants constants follow the same scope rules as variables Attempts to change the value of a constant should result in a type error const columns = 10; columns ++; // type error However, this construct is not supported by MS Internet Explorer 6 10 and does not have the desired effect in Safari before version nor Opera before version 12 Ullrich Hustadt COMP519 Web Programming L11 16

18 Storing Values Values, Variables and Types typeof string typeof value returns a string representation of the type of value Boolean "boolean" Number "number" String "string" Object "object" undefined "undefined" null "object" NaN "number" Infinity "number" Future versions of JavaScript may have an option to change typeof null to "null" (as in PHP) document. writeln (" Type of 23.0: " + typeof (23.0) + " < br / >" document. writeln (" Type of \"23\": " + typeof ("23") +" < br / >" var a document. writeln (" Type of a: " + typeof (a) + "<br / >" Type of 23.0: number < br / > Type of "23": string < br / > Type of a: undefined < br / > Ullrich Hustadt COMP519 Web Programming L11 17

19 Revision Revision and Further Reading Read Chapter 20: The JavaScript Language: Data Types and Variables Chapter 20: The JavaScript Language: Calculations and Operators of S. Schafer: Web Standards Programmer s Reference. Wiley Publishing, Harold Cohen Library S29 or E-book Read Chapter 3: Language Basics: Variables, Data Types, Operators of N. C. Zakas: Professional JavaScript for Web developers. Wrox Press, Harold Cohen Library Z21 or E-book Ullrich Hustadt COMP519 Web Programming L11 18

### COMP284 Scripting Languages Lecture 15: JavaScript (Part 2) Handouts

COMP284 Scripting Languages Lecture 15: JavaScript (Part 2) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

### COMP519 Web Programming Lecture 17: Python (Part 1) Handouts

COMP519 Web Programming Lecture 17: Python (Part 1) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool Contents

### COMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts

COMP284 Scripting Languages Lecture 14: JavaScript (Part 1) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

### COMP519 Web Programming Lecture 12: JavaScript (Part 3) Handouts

COMP519 Web Programming Lecture 12: JavaScript (Part 3) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

### COMP284 Scripting Languages Lecture 10: PHP (Part 2) Handouts

COMP284 Scripting Languages Lecture 10: PHP (Part 2) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

### COMP284 Scripting Languages Lecture 2: Perl (Part 1) Handouts

COMP284 Scripting Languages Lecture 2: Perl (Part 1) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

### COMP519 Web Programming Lecture 14: JavaScript (Part 5) Handouts

COMP519 Web Programming Lecture 14: JavaScript (Part 5) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

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

### COMP519 Web Programming Lecture 20: Python (Part 4) Handouts

COMP519 Web Programming Lecture 20: Python (Part 4) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool Contents

### Chapter 6 Primitive types

Chapter 6 Primitive types Lesson page 6-1. Primitive types Question 1. There are an infinite number of integers, so it would be too ineffient to have a type integer that would contain all of them. Question

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

### JavaScript: The Basics

JavaScript: The Basics CISC 282 October 4, 2017 JavaScript A programming language "Lightweight" and versatile Not universally respected Appreciated in the web domain Adds programmatic functionality to

### Such JavaScript Very Wow

Such JavaScript Very Wow Lecture 9 CGS 3066 Fall 2016 October 20, 2016 JavaScript Numbers JavaScript numbers can be written with, or without decimals. Extra large or extra small numbers can be written

### Client-Side Web Technologies. JavaScript Part I

Client-Side Web Technologies JavaScript Part I JavaScript First appeared in 1996 in Netscape Navigator Main purpose was to handle input validation that was currently being done server-side Now a powerful

### HTML5 and CSS3 More JavaScript Page 1

HTML5 and CSS3 More JavaScript Page 1 1 HTML5 and CSS3 MORE JAVASCRIPT 3 4 6 7 9 The Math Object The Math object lets the programmer perform built-in mathematical tasks Includes several mathematical methods

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

### 3 The Building Blocks: Data Types, Literals, and Variables

chapter 3 The Building Blocks: Data Types, Literals, and Variables 3.1 Data Types A program can do many things, including calculations, sorting names, preparing phone lists, displaying images, validating

### COMP519 Web Programming Lecture 27: PHP (Part 3) Handouts

COMP519 Web Programming Lecture 27: PHP (Part 3) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool Control

### CMPT 125: Lecture 3 Data and Expressions

CMPT 125: Lecture 3 Data and Expressions Tamara Smyth, tamaras@cs.sfu.ca School of Computing Science, Simon Fraser University January 3, 2009 1 Character Strings A character string is an object in Java,

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

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

### JavaScript I Language Basics

JavaScript I Language Basics Chesapeake Node.js User Group (CNUG) https://www.meetup.com/chesapeake-region-nodejs-developers-group START BUILDING: CALLFORCODE.ORG Agenda Introduction to JavaScript Language

### Language Fundamentals Summary

Language Fundamentals Summary Claudia Niederée, Joachim W. Schmidt, Michael Skusa Software Systems Institute Object-oriented Analysis and Design 1999/2000 c.niederee@tu-harburg.de http://www.sts.tu-harburg.de

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

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

### A.A. 2008/09. Why introduce JavaScript. G. Cecchetti Internet Software Technologies

Internet t Software Technologies JavaScript part one IMCNE A.A. 2008/09 Gabriele Cecchetti Why introduce JavaScript To add dynamicity and interactivity to HTML pages 2 What s a script It s a little interpreted

### COMP284 Scripting Languages Lecture 9: PHP (Part 1) Handouts

COMP284 Scripting Languages Lecture 9: PHP (Part 1) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool Contents

### Introduction to Computer Programming CSCI-UA 2. Review Midterm Exam 1

Review Midterm Exam 1 Review Midterm Exam 1 Exam on Monday, October 7 Data Types and Variables = Data Types and Variables Basic Data Types Integers Floating Point Numbers Strings Data Types and Variables

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

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

### COMP1730/COMP6730 Programming for Scientists. Data: Values, types and expressions.

COMP1730/COMP6730 Programming for Scientists Data: Values, types and expressions. Lecture outline * Data and data types. * Expressions: computing values. * Variables: remembering values. What is data?

### CSCE 120: Learning To Code

CSCE 120: Learning To Code Manipulating Data I Introduction This module is designed to get you started working with data by understanding and using variables and data types in JavaScript. It will also

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

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

### COMP284 Scripting Languages Lecture 11: PHP (Part 3) Handouts

COMP284 Scripting Languages Lecture 11: PHP (Part 3) Handouts Ullrich Hustadt Department of Computer Science School of Electrical Engineering, Electronics, and Computer Science University of Liverpool

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

CSCI 2010 Principles of Computer Science Data and Expressions 08/09/2013 CSCI 2010 1 Data Types, Variables and Expressions in Java We look at the primitive data types, strings and expressions that are

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

### Overview: Programming Concepts. Programming Concepts. Names, Values, And Variables

Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

### Overview: Programming Concepts. Programming Concepts. Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript

Chapter 18: Get With the Program: Fundamental Concepts Expressed in JavaScript Fluency with Information Technology Third Edition by Lawrence Snyder Overview: Programming Concepts Programming: Act of formulating

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

### JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1)

Technology & Information Management Instructor: Michael Kremer, Ph.D. Class 2 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) AGENDA

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

### 2 nd Week Lecture Notes

2 nd Week Lecture Notes Scope of variables All the variables that we intend to use in a program must have been declared with its type specifier in an earlier point in the code, like we did in the previous

### 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 COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I

BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment

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

### HUDSONVILLE HIGH SCHOOL COURSE FRAMEWORK

HUDSONVILLE HIGH SCHOOL COURSE FRAMEWORK COURSE / SUBJECT Introduction to Programming KEY COURSE OBJECTIVES/ENDURING UNDERSTANDINGS OVERARCHING/ESSENTIAL SKILLS OR QUESTIONS Introduction to Java Java Essentials

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

### CGS 3066: Spring 2015 JavaScript Reference

CGS 3066: Spring 2015 JavaScript Reference Can also be used as a study guide. Only covers topics discussed in class. 1 Introduction JavaScript is a scripting language produced by Netscape for use within

### XQ: An XML Query Language Language Reference Manual

XQ: An XML Query Language Language Reference Manual Kin Ng kn2006@columbia.edu 1. Introduction XQ is a query language for XML documents. This language enables programmers to express queries in a few simple

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

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

### Chapter 3 Data Types and Variables

Chapter 3 Data Types and Variables Adapted from JavaScript: The Complete Reference 2 nd Edition by Thomas Powell & Fritz Schneider 2004 Thomas Powell, Fritz Schneider, McGraw-Hill Jargon Review Variable

### Chapter 17. Fundamental Concepts Expressed in JavaScript

Chapter 17 Fundamental Concepts Expressed in JavaScript Learning Objectives Tell the difference between name, value, and variable List three basic data types and the rules for specifying them in a program

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

### 4 Programming Fundamentals. Introduction to Programming 1 1

4 Programming Fundamentals Introduction to Programming 1 1 Objectives At the end of the lesson, the student should be able to: Identify the basic parts of a Java program Differentiate among Java literals,

### Lecture 3 Operators MIT AITI

Lecture 3 Operators MIT AITI - 2004 What are Operators? Operators are special symbols used for mathematical functions assignment statements logical comparisons Examples: 3 + 5 // uses + operator 14 + 5

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

### JavaScript CS 4640 Programming Languages for Web Applications

JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation

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

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

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

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

### Built-in Types of Data

Built-in Types of Data Types A data type is set of values and a set of operations defined on those values Python supports several built-in data types: int (for integers), float (for floating-point numbers),

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

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

### Zheng-Liang Lu Java Programming 45 / 79

1 class Lecture2 { 2 3 "Elementray Programming" 4 5 } 6 7 / References 8 [1] Ch. 2 in YDL 9 [2] Ch. 2 and 3 in Sharan 10 [3] Ch. 2 in HS 11 / Zheng-Liang Lu Java Programming 45 / 79 Example Given a radius

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

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

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

### Ex: If you use a program to record sales, you will want to remember data:

Data Variables Programs need to remember values. Ex: If you use a program to record sales, you will want to remember data: A loaf of bread was sold to Sione Latu on 14/02/19 for T\$1.00. Customer Name:

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

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

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

### Values and Variables 1 / 30

Values and Variables 1 / 30 Values 2 / 30 Computing Computing is any purposeful activity that marries the representation of some dynamic domain with the representation of some dynamic machine that provides

### Java Basic Datatypees

Basic Datatypees Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in the memory. Based on the data type of a variable,

### A variable is a name for a location in memory A variable must be declared

Variables A variable is a name for a location in memory A variable must be declared, specifying the variable's name and the type of information that will be held in it data type variable name int total;

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

COMP 110-001 Primitive and Class Types Yi Hong May 14, 2015 Review What are the two major parts of an object? What is the relationship between class and object? Design a simple class for Student How to

### 1 CS580W-01 Quiz 1 Solution

1 CS580W-01 Quiz 1 Solution Date: Wed Sep 26 2018 Max Points: 15 Important Reminder As per the course Academic Honesty Statement, cheating of any kind will minimally result in receiving an F letter grade

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

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

### JAVASCRIPT. sarojpandey.com.np/iroz. JavaScript

JAVASCRIPT 1 Introduction JAVASCRIPT is a compact, object-based scripting language for developing client Internet applications. was designed to add interactivity to HTML pages. is a scripting language

### Ruby: Introduction, Basics

Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 4 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie

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

CHAD Language Reference Manual INTRODUCTION The CHAD programming language is a limited purpose programming language designed to allow teachers and students to quickly code algorithms involving arrays,

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

### Lecture 2: Variables and Operators. AITI Nigeria Summer 2012 University of Lagos.

Lecture 2: Variables and Operators AITI Nigeria Summer 2012 University of Lagos. Agenda Variables Types Naming Assignment Data Types Type casting Operators Declaring Variables in Java type name; Variables

### Data and Expressions. Outline. Data and Expressions 12/18/2010. Let's explore some other fundamental programming concepts. Chapter 2 focuses on:

Data and Expressions Data and Expressions Let's explore some other fundamental programming concepts Chapter 2 focuses on: Character Strings Primitive Data The Declaration And Use Of Variables Expressions

### CHAPTER 5: JavaScript Basics 99

CHAPTER 5: JavaScript Basics 99 5.2 JavaScript Keywords, Variables, and Operators 5.2.1 JavaScript Keywords break case continue default delete do else export false for function if import in new null return

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

### COMS 469: Interactive Media II

COMS 469: Interactive Media II Agenda Review Data Types & Variables Decisions, Loops, and Functions Review gunkelweb.com/coms469 Review Basic Terminology Computer Languages Interpreted vs. Compiled Client

### PRG PROGRAMMING ESSENTIALS. Lecture 2 Program flow, Conditionals, Loops

PRG PROGRAMMING ESSENTIALS 1 Lecture 2 Program flow, Conditionals, Loops https://cw.fel.cvut.cz/wiki/courses/be5b33prg/start Michal Reinštein Czech Technical University in Prague, Faculty of Electrical

### Number Systems, Scalar Types, and Input and Output

Number Systems, Scalar Types, and Input and Output Outline: Binary, Octal, Hexadecimal, and Decimal Numbers Character Set Comments Declaration Data Types and Constants Integral Data Types Floating-Point

### Chapter 2 Elementary Programming

Chapter 2 Elementary Programming Part I 1 Motivations In the preceding chapter, you learned how to create, compile, and run a Java program. Starting from this chapter, you will learn how to solve practical

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

Java Programming, Sixth Edition 2-1 Chapter 2 Using Data At a Glance Instructor s Manual Table of Contents Overview Objectives Teaching Tips Quick Quizzes Class Discussion Topics Additional Projects Additional

### JavaScript CS 4640 Programming Languages for Web Applications

JavaScript CS 4640 Programming Languages for Web Applications 1 How HTML, CSS, and JS Fit Together {css} javascript() Content layer The HTML gives the page structure and adds semantics Presentation