JavaScript: Features, Trends, and Static Analysis

Size: px
Start display at page:

Download "JavaScript: Features, Trends, and Static Analysis"

Transcription

1 JavaScript: Features, Trends, and Static Analysis Joonwon Choi ROPAS Show & Tell 01/25/2013 1

2 Contents What is JavaScript? Features Trends Static Analysis Conclusion & Future Works 2

3 What is JavaScript? Scripting language equipped with prototype, dynamic type, and first-class functions. Formalized in the ECMAScript ECMAScript JavaScript JScript ActionScript 3

4 Features Prototype Object Undefined / Null Type Conversion Primitive Types With / Eval Attributes Arguments First-class Function Inheritances are implemented by prototypes function Person(n) { this.setname(n); Person.prototype.setName = function(n) { this.name = n; function Student(n,s) { this.b = Person; this.b(n); delete this.b; this.studentid = s.tostring(); Student.prototype = new Person; Dynamic Type 4

5 Features Prototype Object Undefined / Null Type Conversion Primitive Types With / Eval Attributes Object is just a mapping from strings to values var a = new Object(); a.property = 3; assert(a.property === 3); // true assert(a[ property ] === 3); // true var s = prop ; s = s + erty ; assert(a[s] === 3); // true Arguments First-class Function Dynamic Type 5

6 Features Prototype Object Undefined / Null Type Conversion Primitive Types With / Eval Attributes Arguments First-class Function Dynamic Type Null is a value with a type null var a = null; assert (a === null); // true assert (a === undefined); // false var b; assert (b === null); // false assert (b === undefined); // true Pitfalls: should use appropriate operators var a = false; assert (a == null); // true assert (a === null); // false var b; assert (b == null); // true assert (b === null); // false 6

7 Features Prototype Object Undefined / Null Type Conversion Primitive Types With / Eval Attributes Arguments First-class Function Dynamic Type Null is a value with a type null var a = null; assert (a === null); // true assert (a === undefined); // false var b; assert (b === null); // false assert (b === undefined); // true Pitfalls: should use appropriate operators var a = false; assert (a == null); // true assert (a === null); // false var b; assert (b == null); // true assert (b === null); // false == compares only values, === compares values and types 7

8 Features Prototype Object Undefined / Null Type Conversion Primitive Types Type conversions are implicitly, frequently occurred, with no exceptions var a = Hello World! ; bar b = 12; a = a + b; assert (a === Hello World!12 ); // true With / Eval Attributes Arguments First-class Function Dynamic Type 8

9 Features Prototype Object Undefined / Null Type Conversion Primitive Types Primitive types are different from wrapped primitive types var a = Hello World ; var b = new String( Hello World ); assert (a == b); // true assert (a === b); // false With / Eval Attributes Arguments First-class Function Dynamic Type 9

10 Features Prototype Object Undefined / Null Type Conversion Primitive Types With / Eval Attributes Some TOO complicated features... var a = new Object(); a.property = Hello World ; with(a) { assert(property === Hello World ); // true a.eval_string = a.property = 13 ; eval(a.eval_string); assert(a.property === 13); // true Arguments First-class Function Dynamic Type 10

11 Features Prototype Object Undefined / Null Properties can have attributes var a = document.url; assert (a === document.url); // true document.url = Hello World ; // impossible, ReadOnly Type Conversion Primitive Types With / Eval Attributes Arguments First-class Function Dynamic Type 11

12 Features Prototype Object Undefined / Null Type Conversion Primitive Types With / Eval Attributes Functions can have arbitrary number of args function alerter() { var s = ; for (arg in arguments) { s = s + + arg; alert(s); alerter(1, Hello, 3, World ); // alerts 1 Hello 3 World Arguments First-class Function Dynamic Type 12

13 Features Prototype Object Undefined / Null Type Conversion Primitive Types With / Eval Attributes Functions are first-class objects function increase(i) { return (i+1); function executor(f, i) { return f(i); var func = increase; assert(executor(func, 1) === 2); // true Arguments First-class Function Dynamic Type 13

14 Features Prototype Object Undefined / Null Type Conversion Primitive Types With / Eval Attributes Types can be dynamically changed var X; if (unknown_statement) { X = Object; else { X = Array; var y = new X(5); // What is the type of y? Arguments First-class Function Dynamic Type 14

15 Trends Prototypes Frequently used Alternative for object-oriented inheritance Analysis problem: objects prototypes can be dynamically changed 15

16 Trends Properties Mostly initialized during object creation, like a constructor. function Person(n) { this.setname(n); Person.prototype.setName = function(n) { this.name = n; Rarely deleted, i.e., delete operator is rarely used. 16

17 Trends With / Eval Without with, eval is evil. Deprecated. 17

18 Trends Codes & Benchmarks Codes are not too long (in web, ~5,000 lines) Existence of well-known benchmarks Chrome Experiments Top 1,000 sites 18

19 Static Analysis Abstract Interpretation Anders Møller, Type Analysis for JavaScript JavaScript > IR Abstracted value Value= Undef Null Bool Num String P(L) Does not treat eval 19

20 Static Analysis Static Taint Analysis Salvatore Guarnieri, Saving the World Wide Web from Vulnerable JavaScript Supports prototype-chain property lookups Handles lexical scoping by SSA form 20

21 Static Analysis Our goal To find malicious behaviors in Tizen web apps, Using source/sink analysis, May design value analysis, if necessary. On SAFE 1 IR 1) H. Lee, S. Won, J. Jin, J. Cho, S. Ryu, "SAFE: Formal Specification and Implementation of a Scalable Analysis Framework for ECMAScript," 2012 International Workshop on Foundations of Object-Oriented Languages, October

22 Conclusion & Future Works Conclusion JavaScript has a lot of complicated features. But trends may make static analysis feasible. Future Works Design a big picture of analysis Take a look into SAFE structures 22

INF5750. Introduction to JavaScript and Node.js

INF5750. Introduction to JavaScript and Node.js INF5750 Introduction to JavaScript and Node.js Outline Introduction to JavaScript Language basics Introduction to Node.js Tips and tools for working with JS and Node.js What is JavaScript? Built as scripting

More information

JavaScript: Sort of a Big Deal,

JavaScript: Sort of a Big Deal, : Sort of a Big Deal, But Sort of Quirky... March 20, 2017 Lisp in C s Clothing (Crockford, 2001) Dynamically Typed: no static type annotations or type checks. C-Like Syntax: curly-braces, for, semicolons,

More information

hybrid security analysis of web JavaScript code via dynamic partial evaluation

hybrid security analysis of web JavaScript code via dynamic partial evaluation hybrid security analysis of web JavaScript code via dynamic partial evaluation Omer Tripp Pietro Ferrara Marco Pistoia! IBM Research, NY 1 Work published at the ACM SIGSOFT International Symposium on Software

More information

JavaScript CS 4640 Programming Languages for Web Applications

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

More information

A Structural Operational Semantics for JavaScript

A Structural Operational Semantics for JavaScript Dept. of Computer Science, Stanford University Joint work with Sergio Maffeis and John C. Mitchell Outline 1 Motivation Web Security problem Informal and Formal Semantics Related work 2 Formal Semantics

More information

JavaScript CS 4640 Programming Languages for Web Applications

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

More information

Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p.

Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p. Preface p. xiii Introduction to JavaScript p. 1 JavaScript Myths p. 2 Versions of JavaScript p. 2 Client-Side JavaScript p. 3 JavaScript in Other Contexts p. 5 Client-Side JavaScript: Executable Content

More information

Static Analysis of JavaScript. Ben Hardekopf

Static Analysis of JavaScript. Ben Hardekopf Static Analysis of JavaScript Insights and Challenges Ben Hardekopf Department of Computer Science University of California, Santa Barbara Setting Expectations What this talk is about Brief introduction

More information

Powerful JavaScript OOP concept here and now. CoffeeScript, TypeScript, etc

Powerful JavaScript OOP concept here and now. CoffeeScript, TypeScript, etc Powerful JavaScript OOP concept here and now. CoffeeScript, TypeScript, etc JavaScript EasyOOP Inheritance, method overriding, constructor, anonymous classes, mixing, dynamic class extending, packaging,

More information

More on JavaScript Functions

More on JavaScript Functions More on JavaScript Functions Nesting Function Definitions Function definitions can be nested. function hypotenuse(a, b) function square(x) return x * x; return Math.sqrt(square(a) + square(b));

More information

Client-Side Web Technologies. JavaScript Part I

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

More information

JavaScript. What s wrong with JavaScript?

JavaScript. What s wrong with JavaScript? JavaScript 1 What s wrong with JavaScript? A very powerful language, yet Often hated Browser inconsistencies Misunderstood Developers find it painful Lagging tool support Bad name for a language! Java

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Boot Camp JavaScript Sioux, March 31, 2011

Boot Camp JavaScript  Sioux, March 31, 2011 Boot Camp JavaScript http://rix0r.nl/bootcamp Sioux, March 31, 2011 Agenda Part 1: JavaScript the Language Short break Part 2: JavaScript in the Browser History May 1995 LiveScript is written by Brendan

More information

Administrivia. Simple data types

Administrivia. Simple data types Administrivia Lists, higher order procedures, and symbols 6.037 - Structure and Interpretation of Computer Programs Mike Phillips (mpp) Massachusetts Institute of Technology Project 0 was due today Reminder:

More information

UNIT -II. Language-History and Versions Introduction JavaScript in Perspective-

UNIT -II. Language-History and Versions Introduction JavaScript in Perspective- UNIT -II Style Sheets: CSS-Introduction to Cascading Style Sheets-Features- Core Syntax-Style Sheets and HTML Style Rle Cascading and Inheritance-Text Properties-Box Model Normal Flow Box Layout- Beyond

More information

JavaScript. Training Offer for JavaScript Introduction JavaScript. JavaScript Objects

JavaScript. Training Offer for JavaScript Introduction JavaScript. JavaScript Objects JavaScript CAC Noida is an ISO 9001:2015 certified training center with professional experience that dates back to 2005. The vision is to provide professional education merging corporate culture globally

More information

Scheme in Scheme: The Metacircular Evaluator Eval and Apply

Scheme in Scheme: The Metacircular Evaluator Eval and Apply Scheme in Scheme: The Metacircular Evaluator Eval and Apply CS21b: Structure and Interpretation of Computer Programs Brandeis University Spring Term, 2015 The metacircular evaluator is A rendition of Scheme,

More information

Language Based isolation of Untrusted JavaScript

Language Based isolation of Untrusted JavaScript Dept. of Computer Science, Stanford University Joint work with Sergio Maffeis (Imperial College London) and John C. Mitchell (Stanford University) Outline 1 Motivation 2 Case Study : FBJS Design Attacks

More information

Mid-Term 2 Grades

Mid-Term 2 Grades Mid-Term 2 Grades 100 46 1 HW 9 Homework 9, in untyped class interpreter: Add instanceof Restrict field access to local class Implement overloading (based on argument count) Due date is the same as for

More information

JavaScript: Introduction, Types

JavaScript: Introduction, Types JavaScript: Introduction, Types Computer Science and Engineering College of Engineering The Ohio State University Lecture 19 History Developed by Netscape "LiveScript", then renamed "JavaScript" Nothing

More information

The course is supplemented by numerous hands-on labs that help attendees reinforce their theoretical knowledge of the learned material.

The course is supplemented by numerous hands-on labs that help attendees reinforce their theoretical knowledge of the learned material. Lincoln Land Community College Capital City Training Center 130 West Mason Springfield, IL 62702 217-782-7436 www.llcc.edu/cctc WA2442 Introduction to JavaScript Objectives This intensive training course

More information

6.184 Lecture 4. Interpretation. Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson

6.184 Lecture 4. Interpretation. Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson 6.184 Lecture 4 Interpretation Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson 1 Interpretation Parts of an interpreter Arithmetic calculator

More information

TRANSLATING DART TO EFFICIENT JAVASCRIPT. Kasper Lund Google

TRANSLATING DART TO EFFICIENT JAVASCRIPT. Kasper Lund Google TRANSLATING DART TO EFFICIENT JAVASCRIPT Kasper Lund Google Translating Dart to efficient JavaScript Kasper Lund, Google Who am I? Kasper Lund, software engineer at Google Projects OOVM: Embedded Smalltalk

More information

Lecture 3: The Basics of JavaScript. Background. Needs for Programming Capability. Origin of JavaScript. Using Client-side JavaScript

Lecture 3: The Basics of JavaScript. Background. Needs for Programming Capability. Origin of JavaScript. Using Client-side JavaScript Lecture 3: The Basics of JavaScript Wendy Liu CSC309F Fall 2007 Background Origin and facts 1 2 Needs for Programming Capability XHTML and CSS allows the browser to passively display static content How

More information

Ruby: Introduction, Basics

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

More information

Turtles All The Way Down

Turtles All The Way Down Turtles All The Way Down Bertrand Russell had just finished giving a public lecture on the nature of the universe. An old woman said Prof. Russell, it is well known that the earth rests on the back of

More information

6.037 Lecture 4. Interpretation. What is an interpreter? Why do we need an interpreter? Stages of an interpreter. Role of each part of the interpreter

6.037 Lecture 4. Interpretation. What is an interpreter? Why do we need an interpreter? Stages of an interpreter. Role of each part of the interpreter 6.037 Lecture 4 Interpretation Interpretation Parts of an interpreter Meta-circular Evaluator (Scheme-in-scheme!) A slight variation: dynamic scoping Original material by Eric Grimson Tweaked by Zev Benjamin,

More information

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary

More information

ROSAEC Survey Workshop SELab. Soohyun Baik

ROSAEC Survey Workshop SELab. Soohyun Baik ROSAEC Survey Workshop SELab. Soohyun Baik Cross-Site Scripting Prevention with Dynamic Data Tainting and Static Analysis Philipp Vogt, Florian Nentwich, Nenad Jovanovic, Engin Kirda, Christopher Kruegel,

More information

Functional Programming. Pure Functional Programming

Functional Programming. Pure Functional Programming Functional Programming Pure Functional Programming Computation is largely performed by applying functions to values. The value of an expression depends only on the values of its sub-expressions (if any).

More information

CS 360 Programming Languages Interpreters

CS 360 Programming Languages Interpreters CS 360 Programming Languages Interpreters Implementing PLs Most of the course is learning fundamental concepts for using and understanding PLs. Syntax vs. semantics vs. idioms. Powerful constructs like

More information

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

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

More information

Parsing Scheme (+ (* 2 3) 1) * 1

Parsing Scheme (+ (* 2 3) 1) * 1 Parsing Scheme + (+ (* 2 3) 1) * 1 2 3 Compiling Scheme frame + frame halt * 1 3 2 3 2 refer 1 apply * refer apply + Compiling Scheme make-return START make-test make-close make-assign make- pair? yes

More information

Comp 311: Sample Midterm Examination

Comp 311: Sample Midterm Examination Comp 311: Sample Midterm Examination October 29, 2007 Name: Id #: Instructions 1. The examination is closed book. If you forget the name for a Scheme operation, make up a name for it and write a brief

More information

Why do we need an interpreter? SICP Interpretation part 1. Role of each part of the interpreter. 1. Arithmetic calculator.

Why do we need an interpreter? SICP Interpretation part 1. Role of each part of the interpreter. 1. Arithmetic calculator. .00 SICP Interpretation part Parts of an interpreter Arithmetic calculator Names Conditionals and if Store procedures in the environment Environment as explicit parameter Defining new procedures Why do

More information

JavaScript Programming

JavaScript Programming JavaScript Programming Mendel Rosenblum 1 How do you program in JavaScript? From Wikipedia:... supporting object-oriented, imperative, and functional programming... Mostly programming conventions (i.e.

More information

Static Analysis for JavaScript

Static Analysis for JavaScript Static Analysis for JavaScript Adi Yoga Sidi Prabawa Supervisor: Associate Professor Chin Wei Ngan Department of Computer Science School of Computing National University of Singapore June 30, 2013 Abstract

More information

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G.

Scheme: Data. CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, Glenn G. Scheme: Data CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Monday, April 3, 2017 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks ggchappell@alaska.edu

More information

B l o c k B i n d i n g s

B l o c k B i n d i n g s 1 Block Bindings Traditionally, the way variable declarations work has been one tricky part of programming in JavaScript. In most C-based languages, variables (more formally known as bindings, as a name

More information

JavaScript for C# Programmers Kevin

JavaScript for C# Programmers Kevin JavaScript for C# Programmers Kevin Jones kevin@rocksolidknowledge.com @kevinrjones http://www.github.com/kevinrjones Agenda Types Basic Syntax Objects Functions 2 Basics 'C' like language braces brackets

More information

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications

JavaScript. History. Adding JavaScript to a page. CS144: Web Applications JavaScript Started as a simple script in a Web page that is interpreted and run by the browser Supported by most modern browsers Allows dynamic update of a web page More generally, allows running an arbitrary

More information

CS 130(0) JavaScript Lab

CS 130(0) JavaScript Lab CS 130(0) JavaScript Lab Lab Setup The presentation slides can be found at the following link: Presentation Slides The only software that you ll need in order to complete this lab is access to the Google

More information

Object Oriented jquery with MooTools. by Ryan Florence

Object Oriented jquery with MooTools. by Ryan Florence Object Oriented jquery with MooTools by Ryan Florence $(document).ready(function(){ $('#my-form').submit(function(event){ event.preventdefault(); $.post($(this).attr('action'), $(this).serialize(), function(data){

More information

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

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

More information

A Structural Operational Semantics for JavaScript

A Structural Operational Semantics for JavaScript Dept. of Computer Science, Stanford University 1 Need for a Formal Semantics? 2 Structural Operational Semantics for IMP Formalizing the program state Semantic Rules Formal properties 3 Structural Operational

More information

Basics of JavaScript. Last Week. Needs for Programming Capability. Browser as Development Platform. Using Client-side JavaScript. Origin of JavaScript

Basics of JavaScript. Last Week. Needs for Programming Capability. Browser as Development Platform. Using Client-side JavaScript. Origin of JavaScript Basics of JavaScript History of the Web XHTML CSS Last Week Nan Niu (nn@cs.toronto.edu) CSC309 -- Fall 2008 2 Needs for Programming Capability XHTML and CSS allows the browser to passively display static

More information

Why Discuss JavaScript? CS312: Programming Languages. Lecture 21: JavaScript. JavaScript Target. What s a Scripting Language?

Why Discuss JavaScript? CS312: Programming Languages. Lecture 21: JavaScript. JavaScript Target. What s a Scripting Language? Why Discuss JavaScript? CS312: Programming Languages Lecture 21: JavaScript Thomas Dillig JavaScript is very widely used and growing Any AJAX application heavily relies on JavaScript JavaScript also has

More information

CS312: Programming Languages. Lecture 21: JavaScript

CS312: Programming Languages. Lecture 21: JavaScript CS312: Programming Languages Lecture 21: JavaScript Thomas Dillig Thomas Dillig, CS312: Programming Languages Lecture 21: JavaScript 1/25 Why Discuss JavaScript? JavaScript is very widely used and growing

More information

Relation Overriding. Syntax and Semantics. Simple Semantic Domains. Operational Semantics

Relation Overriding. Syntax and Semantics. Simple Semantic Domains. Operational Semantics SE3E03, 2006 1.59 61 Syntax and Semantics Syntax Shape of PL constructs What are the tokens of the language? Lexical syntax, word level How are programs built from tokens? Mostly use Context-Free Grammars

More information

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) CSE 413 Languages & Implementation Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) 1 Goals Representing programs as data Racket structs as a better way to represent

More information

Static Analysis of Dynamically Typed Languages made Easy

Static Analysis of Dynamically Typed Languages made Easy Static Analysis of Dynamically Typed Languages made Easy Yin Wang School of Informatics and Computing Indiana University Overview Work done as two internships at Google (2009 summer and 2010 summer) Motivation:

More information

Operational Semantics. One-Slide Summary. Lecture Outline

Operational Semantics. One-Slide Summary. Lecture Outline Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:

More information

Subroutines. Subroutines. The Basics. aka: user-defined functions, methods, procdures, sub-procedures, etc etc etc.

Subroutines. Subroutines. The Basics. aka: user-defined functions, methods, procdures, sub-procedures, etc etc etc. Subroutines Subroutines aka: user-defined functions, methods, procdures, sub-procedures, etc etc etc We ll just say Subroutines. "Functions" generally means built-in functions perldoc perlsub The Basics

More information

Scripting for Multimedia LECTURE 3: INTRODUCING JAVASCRIPT

Scripting for Multimedia LECTURE 3: INTRODUCING JAVASCRIPT Scripting for Multimedia LECTURE 3: INTRODUCING JAVASCRIPT Understanding Javascript Javascript is not related to Java but to ECMAScript It is widely used for client-side scripting on the web Javascript,

More information

CSC Web Programming. Introduction to JavaScript

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

More information

JavaScript: More Syntax

JavaScript: More Syntax JavaScript: More Syntax CISC 282 October 23, 2018 null and undefined What s the difference? null is synonymous with nothing i.e., no value, nothing there undefined is synonymous with the unknown i.e.,

More information

Midterm 3 practice problems

Midterm 3 practice problems Midterm 3 practice problems CS 133 May 3, 218 1 Hash functions and hash tables What are the two good hash methods we discussed, and how do they work? Remainder: use Horner s method to treat the string

More information

Project 5 Due 11:59:59pm Wed, Nov 25, 2015 (no late submissions)

Project 5 Due 11:59:59pm Wed, Nov 25, 2015 (no late submissions) Introduction Project 5 Due 11:59:59pm Wed, Nov 25, 2015 (no late submissions) In this project, you will write a compiler for a programming language called Rube, which is a small objectoriented programming

More information

CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures. Dan Grossman Autumn 2018

CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures. Dan Grossman Autumn 2018 CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures Dan Grossman Autumn 2018 Typical workflow concrete syntax (string) "(fn x => x + x) 4" Parsing Possible errors / warnings

More information

FALL 2017 CS 498RK JAVASCRIPT. Fashionable and Functional!

FALL 2017 CS 498RK JAVASCRIPT. Fashionable and Functional! CS 498RK FALL 2017 JAVASCRIPT Fashionable and Functional! JAVASCRIPT popular scripting language on the Web, supported by browsers separate scripting from structure (HTML) and presentation (CSS) client-

More information

TAIL RECURSION, SCOPE, AND PROJECT 4 11

TAIL RECURSION, SCOPE, AND PROJECT 4 11 TAIL RECURSION, SCOPE, AND PROJECT 4 11 COMPUTER SCIENCE 61A Noveber 12, 2012 1 Tail Recursion Today we will look at Tail Recursion and Tail Call Optimizations in Scheme, and how they relate to iteration

More information

Today. Continue our very basic intro to JavaScript. Lambda calculus

Today. Continue our very basic intro to JavaScript. Lambda calculus JavaScript (cont) Today Continue our very basic intro to JavaScript Lambda calculus Last lecture recap JavaScript was designed in 10 days Lots of unsatisfactory parts (in retrospect); many due due to the

More information

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

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

More information

This document defines the ActionScript 3.0 language, which is designed to be forward- compatible with the next edition of ECMAScript (ECMA-262).

This document defines the ActionScript 3.0 language, which is designed to be forward- compatible with the next edition of ECMAScript (ECMA-262). ActionScript 3.0 Language Specification This document defines the ActionScript 3.0 language, which is designed to be forward- compatible with the next edition of ECMAScript (ECMA-262). This document is

More information

Attacking ECMAScript Engines with Redefinition. Natalie

Attacking ECMAScript Engines with Redefinition. Natalie Attacking ECMAScript Engines with Redefinition Natalie Silvanovich @natashenka About me Security Engineer on Project Zero Flash Enthusiast Redefinition Vulnerabilities ECMAScript allows anything to be

More information

Ruby: Introduction, Basics

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

More information

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

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

More information

Computer Science II (20082) Week 1: Review and Inheritance

Computer Science II (20082) Week 1: Review and Inheritance Computer Science II 4003-232-08 (20082) Week 1: Review and Inheritance Richard Zanibbi Rochester Institute of Technology Review of CS-I Syntax and Semantics of Formal (e.g. Programming) Languages Syntax

More information

Javascript. Daniel Zappala. CS 360 Internet Programming Brigham Young University

Javascript. Daniel Zappala. CS 360 Internet Programming Brigham Young University Javascript Daniel Zappala CS 360 Internet Programming Brigham Young University Introduction 3/35 Introduction Basics Functions Data Structures Higher-Order Functions Prototypes What You Should Read Eloquent

More information

JavaScript: Coercion, Functions, Arrays

JavaScript: Coercion, Functions, Arrays JavaScript: Coercion, Functions, Arrays Computer Science and Engineering College of Engineering The Ohio State University Lecture 20 Conversion of Primitive Values String Number Boolean numbers 0 "0" false

More information

security analysis with WALA Omer Tripp IBM TJ Watson

security analysis with WALA Omer Tripp IBM TJ Watson security analysis with WALA Omer Tripp IBM TJ Watson Workshop on WALA (WoW), 13 June 2015 collaborators Marco Pistoia Patrick Cousot Radhia Cousot Julian Dolby Manu Sridharan Pietro Ferrrara Steve Fink

More information

Scala : an LLVM-targeted Scala compiler

Scala : an LLVM-targeted Scala compiler Scala : an LLVM-targeted Scala compiler Da Liu, UNI: dl2997 Contents 1 Background 1 2 Introduction 1 3 Project Design 1 4 Language Prototype Features 2 4.1 Language Features........................................

More information

React. HTML code is made up of tags. In the example below, <head> is an opening tag and </head> is the matching closing tag.

React. HTML code is made up of tags. In the example below, <head> is an opening tag and </head> is the matching closing tag. Document Object Model (DOM) HTML code is made up of tags. In the example below, is an opening tag and is the matching closing tag. hello The tags have a tree-like

More information

Functions & First Class Function Values

Functions & First Class Function Values Functions & First Class Function Values PLAI 1st ed Chapter 4, PLAI 2ed Chapter 5 The concept of a function is itself very close to substitution, and to our with form. Consider the following morph 1 {

More information

Topics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited

Topics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited CMSC 330: Organization of Programming Languages Type Systems, Names & Binding Topics Covered Thus Far Programming languages Syntax specification Regular expressions Context free grammars Implementation

More information

DLint: Dynamically Checking Bad Coding Practices in JavaScript

DLint: Dynamically Checking Bad Coding Practices in JavaScript DLint: Dynamically Checking Bad Coding Practices in JavaScript Lian Gong, Michael Pradel, Manu Sridharan and Koushik Sen Presented by Adriano Lages dos Santos Belo Horizonte - 16/04/2015 Introduction Javascript

More information

Assignment 7: functions and closure conversion (part 1)

Assignment 7: functions and closure conversion (part 1) Assignment 7: functions and closure conversion (part 1) ECEN 4553 & 5013, CSCI 4555 & 5525 Prof. Jeremy G. Siek November 12, 2008 The main ideas for this week are: first-class functions lexical scoping

More information

this keyword in java javatpoint

this keyword in java javatpoint this keyword in java javatpoint There can be a lot of usage of java this keyword. In java, this is a reference variable that refers to the current object. Usage of java this keyword Here is given the 6

More information

MatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017

MatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017 MatchaScript: Language Reference Manual Programming Languages & Translators Spring 2017 Language Guru: Kimberly Hou - kjh2146 Systems Architect: Rebecca Mahany - rlm2175 Manager: Jordi Orbay - jao2154

More information

Lecture 12: Conditional Expressions and Local Binding

Lecture 12: Conditional Expressions and Local Binding Lecture 12: Conditional Expressions and Local Binding Introduction Corresponds to EOPL 3.3-3.4 Please review Version-1 interpreter to make sure that you understand how it works Now we will extend the basic

More information

SEMANTIC ANALYSIS TYPES AND DECLARATIONS

SEMANTIC ANALYSIS TYPES AND DECLARATIONS SEMANTIC ANALYSIS CS 403: Type Checking Stefan D. Bruda Winter 2015 Parsing only verifies that the program consists of tokens arranged in a syntactically valid combination now we move to check whether

More information

CS61A Notes Week 13: Interpreters

CS61A Notes Week 13: Interpreters CS61A Notes Week 13: Interpreters Read-Eval Loop Unlike Python, the result of evaluating an expression is not automatically printed. Instead, Logo complains if the value of any top-level expression is

More information

Node.js Training JavaScript. Richard richardrodger.com

Node.js Training JavaScript. Richard richardrodger.com Node.js Training JavaScript Richard Rodger @rjrodger richardrodger.com richard.rodger@nearform.com A New Look at JavaScript Embracing JavaScript JavaScript Data Structures JavaScript Functions Functional

More information

Ruby: Introduction, Basics

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

More information

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Lecture 13. Notation. The rules. Evaluation Rules So Far Lecture Outline Operational Semantics of Cool Lecture 13 COOL operational semantics Motivation Notation The rules Prof. Aiken CS 143 Lecture 13 1 Prof. Aiken CS 143 Lecture 13 2 Motivation We must specify

More information

iwiki Documentation Release 1.0 jch

iwiki Documentation Release 1.0 jch iwiki Documentation Release 1.0 jch January 31, 2014 Contents i ii Contents: Contents 1 2 Contents CHAPTER 1 Python 1.1 Python Core 1.1.1 Strings 1.1.2 Functions Argument Lists *args tuple/list **kwargs

More information

Programming language components

Programming language components Programming language components syntax: grammar rules for defining legal statements what's grammatically legal? how are things built up from smaller things? semantics: what things mean what do they compute?

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages Lesson 14 Type Checking Collaboration and Management Dana Fisman www.cs.bgu.ac.il/~ppl172 1 Type Checking We return to the issue of type safety we discussed informally,

More information

Tamarin and ECMAScript 4. John Resig (ejohn.org) Mozilla Corporation

Tamarin and ECMAScript 4. John Resig (ejohn.org) Mozilla Corporation Tamarin and ECMAScript 4 John Resig (ejohn.org) Mozilla Corporation The Big Picture ECMAScript 3 JavaScript 1.5 ActionScript 2 JScript Etc. SpiderMonkey AVM JScript Engine KJS (Apple) Rhino Opera The Direction

More information

Basics of Using Lisp! Gunnar Gotshalks! BLU-1

Basics of Using Lisp! Gunnar Gotshalks! BLU-1 Basics of Using Lisp BLU-1 Entering Do Lisp work Exiting Getting into and out of Clisp % clisp (bye)» A function with no arguments» CTRL d can also be used Documentation files are in the directory» /cse/local/doc/clisp

More information

Building up a language SICP Variations on a Scheme. Meval. The Core Evaluator. Eval. Apply. 2. syntax procedures. 1.

Building up a language SICP Variations on a Scheme. Meval. The Core Evaluator. Eval. Apply. 2. syntax procedures. 1. 6.001 SICP Variations on a Scheme Scheme Evaluator A Grand Tour Techniques for language design: Interpretation: eval/appl Semantics vs. snta Sntactic transformations Building up a language... 3. 1. eval/appl

More information

CSE 341: Programming Languages

CSE 341: Programming Languages CSE 341: Programming Languages Winter 2005 Lecture 17 varargs and apply, implementing higher-order functions CSE341 Winter 2005, Lecture 17 1 Today: Some easy Scheme odds and ends Implementing higher-order

More information

Fall Semester, The Metacircular Evaluator. Today we shift perspective from that of a user of computer langugaes to that of a designer of

Fall Semester, The Metacircular Evaluator. Today we shift perspective from that of a user of computer langugaes to that of a designer of 1 MASSACHVSETTS INSTITVTE OF TECHNOLOGY Department of Electrical Engineering and Computer Science 6.001 Structure and Interpretation of Computer Programs Fall Semester, 1996 Lecture Notes { October 31,

More information

The Eval/Apply Cycle Eval. Evaluation and universal machines. Examining the role of Eval. Eval from perspective of language designer

The Eval/Apply Cycle Eval. Evaluation and universal machines. Examining the role of Eval. Eval from perspective of language designer Evaluation and universal machines What is the role of evaluation in defining a language? How can we use evaluation to design a language? The Eval/Apply Cycle Eval Exp & env Apply Proc & args Eval and Apply

More information

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far.

Lecture Outline. COOL operational semantics. Operational Semantics of Cool. Motivation. Notation. The rules. Evaluation Rules So Far. Lecture Outline Operational Semantics of Cool COOL operational semantics Motivation Adapted from Lectures by Profs. Alex Aiken and George Necula (UCB) Notation The rules CS781(Prasad) L24CG 1 CS781(Prasad)

More information

Some Facts Web 2.0/Ajax Security

Some Facts Web 2.0/Ajax Security /publications/notes_and_slides Some Facts Web 2.0/Ajax Security Allen I. Holub Holub Associates allen@holub.com Hackers attack bugs. The more complex the system, the more bugs it will have. The entire

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 7b Andrew Tolmach Portland State University 1994-2017 Values and Types We divide the universe of values according to types A type is a set of values and

More information

6.001 Notes: Section 15.1

6.001 Notes: Section 15.1 6.001 Notes: Section 15.1 Slide 15.1.1 Our goal over the next few lectures is to build an interpreter, which in a very basic sense is the ultimate in programming, since doing so will allow us to define

More information

Project 5 Due 11:59:59pm Tuesday, April 25, 2017

Project 5 Due 11:59:59pm Tuesday, April 25, 2017 Project 5 Due 11:59:59pm Tuesday, April 25, 2017 Introduction In this project, you will write a compiler for a programming language called Rube, which is a small objectoriented programming language with

More information