Principles of Programming Languages

Size: px
Start display at page:

Download "Principles of Programming Languages"

Transcription

1 Principles of Programming Languages Collaboration and Management Dana Fisman Lesson 2 - Types with TypeScript 1

2 Types What are types in programming languages? What types are you familiar with? Why are they needed? Why should we distinguish different types? 2

3 Type of Values A value-type defines a set of values. Examples: Booleans { true, false } Numbers { 0, 1, 2,, , 1/3, e, } Strings { a, abc, some words, } Each value-type is associated with a set of operations that can be done on these values. Different value-types are represented differently in memory 3

4 Expressions and Types Programming language use complex expressions. age > 18? true : false Eventually we would like to compute the resulting value of an expression. Different expressions evaluate to different value types. Does the calculation process needs to be aware of types? 4

5 Expressions and Types What if the value of age is ab??? Is it legal? age > 18? true : false If not, when should the error be discovered (compilation-time? run-time?) If yes, what should be the result? 5

6 Why distinguish types? Because some operators (and functions) can operate only on certain types of values 6

7 A Programming Language Syntax Semantics A grammar defining the set of allowed programs Defines the meaning of the program unambiguously Built inductively from atomic elements and operations that can be applied to (possibly compound) elements The definition follows the inductive definition of programs 7

8 Why do we need a formal semantics? So that we can agree what is the output of a given program. o The formal semantics provides an unambiguous definition of what its execution should achieve. o Various tools manipulate programs (compilers, interpreters, debuggers, IDEs, verification tools). o All of these tools must agree upon a formal specification of what is expected when we execute the program. o Without formal semantics we cannot validate the correctness of programs 8

9 Semantic Domain Formal semantics gives rules for translation from one domain (usually the program s syntax) to another formally defined domain. There are various ways to define the semantics of a programming language (denotational, operational, axiomatizational, ) We will use the operational semantics approach. 9

10 Operational Semantics The Operational Semantics approach determines that: the meaning of an expression in the programming language is specified by the computation it induces when it is executed on a machine. It prescribes how to execute the program step by step. When we follow this specification, we can record the steps and keep track of the state of the computation as steps are executed. 10

11 Example using an Imperative Program Initial state: [x:5, y:3, z:7] Program: "z = x; x = y; y = z;" Processes so far Left to process z = x; x = y; y = z; Computation state: x:5 y:3 z:7 11

12 Example using an Imperative Program Initial state: [x:5, y:3, z:7] Program: "z = x; x = y; y = z;" Processes so far Left to process z = x; x = y; y = z; Computation state: x:5 y:3 z:7 x:5 y:3 z:5 12

13 Example using an Imperative Program Initial state: [x:5, y:3, z:7] Program: "z = x; x = y; y = z;" Processes so far Left to process z = x; x = y; y = z; Computation state: x:5 y:3 z:7 x:5 y:3 z:5 x:3 y:3 z:5 13

14 Example using an Imperative Program Initial state: [x:5, y:3, z:7] Program: "z = x; x = y; y = z;" 14 Computation state: x:5 y:3 z:7 Processes so far Left to process z = x; x = y; y = z; x:5 y:3 z:5 x:3 y:3 z:5 The evaluation process results in computation history x:3 y:5 z:5 The new state at each step was determined by applying the semantics of the processed step (here assignment)

15 Operational Semantics Is it a complete recipe for tool implementors? No. The operational semantics provides an abstraction. It does not provide all the details of what should happen in a concrete computation on specific hardware. For example, it does not mention registers, translation to machine language, encoding of data types. The computation history is a formal mathematical object which is in the semantic domain. 15

16 Operational Semantics The rules of the semantics of the specific programming language indicate: o how to select a sub-expression to evaluate at each step of the computation, and o what are the effects on the state of the computation each time a primitive sub-expression is executed o the state of the computation includes the program that is left to process and the environment o the environment includes the information that was recorded and is needed to complete the processing of the program In summary, the operational semantics of the language maps a program and an initial state to a formal structure we call a computation history. 16

17 Expressions vs. Statements Programs in FP are compound expressions (built from sub-expressions using the syntax of the programming language) In FP programs are processed by evaluating expressions Programs in IP are compound statements (built from sub-statements using the syntax of the programming language) In IP programs are processed by executing statements 17

18 In FP programs are expressions Expressions can either be: Atomic not made up of sub-expressions -12 // a number expression true // a boolean expression x // a variable expression Compound made up of sub-expressions according to the syntax 12 >= 7 // made up by applying comparison // to sub-expressions 12 and 7 (x < 100)? -1 : 2 // conditional expression applied // to sub-expressions (x < 100), // -1 and 2 18

19 Expression Tree Expressions are combined recursively to form trees of compound expressions with atomic expressions at the leaves. { let v = 12; (v >= 7)? (v * 3) : 9 } let =? : v 12 >= * 9 v 7 v 3 19

20 Expression Tree Expressions are combined recursively to form trees of compound expressions with atomic expressions at the leaves. { let v = 12; (v >= 7)? (v * 3) : 9 } let =? : v 12 >= * 9 v 7 v 3 20

21 Operational Semantics of FP In FP programs are processed by evaluating expressions The evaluation function maps expressions to values. The operational semantics of an FP language describes how the evaluation function operates over all possible expressions in the language. It is defined inductively over the syntactic structure of expressions. It uses an environment to record the needed info. 21

22 The Evaluation Algorithm Given an expression e o Identify the top-level syntactic construct of e o Identify the immediate sub-expressions of e o Perform the specific evaluation rule defined for the construct of e Continues recursively until there are no subexpressions left to evaluate (when leaves are reached) 22

23 let { let v = <expr>; <body-expr> } Intuitive semantics: Evaluate <body-expr> using local variable v Operational semantics: o Evaluate the <expr> to value v1 o Bind v to v1 o Evaluate <body-expr> to value v2 o Discard the binding of v o Return v2 23

24 Example of Evaluation { let v = 12; (v >= 7)? (v * 3) : 9 } let =? : v 12 >= * 9 Environment v 7 v 3 24

25 Example of Evaluation { let v = 12; (v >= 7)? (v * 3) : 9 } let =? : v 12 >= * 9 Environment v 12 v 7 v 3 25

26 Example of Evaluation { let v = 12; (v >= 7)? (v * 3) : 9 } let? : >= * 9 Environment v 12 v 7 v 3 26

27 Example of Evaluation { let v = 12; (v >= 7)? (v * 3) : 9 } let? : >= * 9 Environment v 12 v 7 v 3 27

28 Example of Evaluation { let v = 12; (v >= 7)? (v * 3) : 9 } let? : true * 9 Environment v 12 v 3 28

29 Example of Evaluation { let v = 12; (v >= 7)? (v * 3) : 9 } let? : true * 9 Environment v 12 v 3 29

30 Example of Evaluation { let v = 12; (v >= 7)? (v * 3) : 9 } let? : true 36 9 Environment v 12 30

31 Example of Evaluation { let v = 12; (v >= 7)? (v * 3) : 9 } let? : true 36 9 Environment v 12 31

32 Example of Evaluation { let v = 12; (v >= 7)? (v * 3) : 9 } let 36 Environment v 12 32

33 Example of Evaluation { let v = 12; (v >= 7)? (v * 3) : 9 } let 36 Environment v 12 33

34 Example of Evaluation { let v = 12; (v >= 7)? (v * 3) : 9 } 36 Environment The evaluation process reduces the expression step by step until the entire expression is reduced to the returned value This process is thus often termed reduction 34

35 Summary - Operational Semantics Semantics gives meaning to the program constructs (by which we can derive the meaning of a complete program) Operational semantics provides the meaning by prescribing step by step evaluation It distinguishes mathematical functions from functions in programming language (which, by the operational semantics we can view as procedures). 35

36 Types of Expressions The Javascript language mixes both expressions and statements (as it is a multi-paradigm language). This makes it difficult to describe completely its operational semantics in a concise manner. We will completely define a smaller language later on in the course, and suffice now with an informal description for Javascript. 36

37 Types of Expressions in Javascript Atomic expressions: number expressions -12, string expressions "abc", boolean expressions false. Compound expressions: arithmetic expressions (10 + v) * (w / 5), conditional expressions (x > 5), ternary conditional expression <condition>? <expr1> : <expr2>. 37

38 Types of Expressions in Javascript Variable bindings: let <var> = <expr1>; <expr2> Function invocation: f(<expr1>,...,<exprn>) Function definition: (<var1>, ) => <expr>. This list of expressions determines the syntax of a subset of programs in Javascript. 38

39 Types in Programming Languages In the same manner that expressions can be atomic or compound, the values that a program generates can be atomic or command no subcomponents numbers booleans Have subcomponents arrays 39

40 Compound Values Ways to create compound variables: o Literals in the program o Using primitive constructs [1,2,3,4,5] [1,2,3].concat([7,27]) [1,2,3,7,27] [1,[100,200],3] How would you write/create such a compound value in Java? 40 o Deserialized from strings that represent compound values according to a value syntax (see the later lecture on JSON for example).

41 Typed vs. Untyped Languages o Typed Languages Require programmers to specify the type of variables upon their declaration o UnTyped Languages C++, Java JavaScript, Scheme, Python Do not have such requirement There are finer classifications of typeness in programming languages What are the advantages and disadvantages of declaring types? 41

42 Typing Errors at Runtime x is untyped function square(x) {return x * x;} Yet, a number value is expected square(3) square( abc ) 42 ==> 9 ==> NaN Not a Number If on evaluation typeincompatibility is discovered usually a runtime error is issued. This is a special numeric value rather than a runtime error

43 When should a runtime error be issued? Python Scheme (+ 3 6) JavaScript ==> 9 ==> 9 ==> 9 abc abc abc ==> abc ==> abc ==> abc ab + cd (+ ab cd ) ab + cd ==> abcd ==> +: contract violation expected: number? given: "ab" argument position: 1st ==> abcd 43 ab + 3 ==> TypeError: must be str, not int (+ ab 3) ab + 3 ==> +: contract violation expected: number? given: "ab" argument position: 1st ==> ab3

44 Javascript Primitives do not Fail Javascript design choice: Primitive operators are extremely flexible and robust Evaluation of strange things do not trigger a runtime-error, instead it either makes automatic conversions or returns special symbols denoting impossible values. "a" > "ab" "a" * 2 "a" && true ==> false ==> 2ab ==> NaN Not a Number ==> true This is a dubious decision - as such automatic handling of unexpected variations is most often a sign of poorly written code and produces surprising results. 44

45 Variable Access in Javascript Accessors to compound data in Javascript do not fail Referencing undefined variables in Javascript do fail 45 let arr=[1,2,3]; arr[10] ==> undefined a special value let map={a:1, b:2} map.c ==> undefined not a rumtime error! let b=2; c; // c is undefined ==> ReferenceError: c is not defined at evalmachine.<anonymous>:3:1 at ContextifyScript.Script.runInThisContext (vm.js:26:33) at Object.exports.runInThisContext (vm.js:79:17) at run ([eval]:608:19) at onrunrequest ([eval]:379:22) at onmessage ([eval]:347:17) at emittwo (events.js:106:13) at process.emit (events.js:191:7) at process.nexttick (internal/child_process.js:752:12) at _combinedtickcallback (internal/process/next_tick.js:6 e.k // e is undefined ==> ReferenceError: E is not defined at evalmachine.<anonymous>:2:1 at ContextifyScript.Script.runInThisContext (vm.js:26: at Object.exports.runInThisContext (vm.js:79:17) at run ([eval]:608:19) at onrunrequest ([eval]:379:22) at onmessage ([eval]:347:17) at emittwo (events.js:106:13) at process.emit (events.js:191:7) at process.nexttick (internal/child_process.js:752:12)

46 Type Safety Can we avoid such errors and unpleasant surprises? What are the benefits of declaring the types of variables? Type safety is the extent to which a programming language discourages or prevents type errors. A type error is erroneous or undesirable program behavior caused by a discrepancy between differing data types for the program's constants, variables, and methods (functions). 46

47 Type Safety Type enforcement can be either: static catching potential errors at compile time, or dynamic associating type information with values at run-time and consulting them as needed to detect imminent errors or a combination of both. Type safety in static-type (compile-time) systems, usually involves a guarantee that the eventual value of any expression will be a legitimate member of that expression's static type. 47

48 Type of Values A value-type defines a set of values. Examples: Booleans { true, false } Numbers { 0, 1, 2,, , 1/3, e, } Strings { a, abc, some words, } Each value-type is associated with a set of operations that can be done on these values. Different value-types are represented differently in memory 48

49 Types: Value vs. Variable type of a value a value always has a type type of a variable a variable are part of expressions it belongs to some set of values on evaluation they are bound to a value 49 perhaps to several a declaration of a type of a variable expresses the programmers intent for the values the variable will assume

50 Types and Set Relations Since value-types define set of values we can reason about them using set theory notions Let T1, T2 denote value-types. We can say that o T1 is a subset of T2 o T1 and T2 are disjoint o T1 is universal (any in Javascript) o T1 is finite o T1 is infinite 50

51 Types and Set Relations We can construct new types using existing types o T1 union T2 o T1 intersection T2 o T1 x T2 (cartesian product) Compound types (such as arrays) can be defined using just these basic set relation operators Programming languages offer additional ways to construct new types These are basically syntactic sugaring 51

52 Javascript vs. Typescript Typescript is an extension of Javascript (every Javascript program is legal Typescript program) In Javascript variables are not typed, values have types Typescript adds the ability to define a type of variable (this is optional) Typescript programs can be translated to Javascript programs 52 This process does both: Eliminates the types definition (so the result is (untyped) Javascript program) Checks types compatibility

53 Javascript Primitive Value Types Ordinary atomic value types o Booleans : { true, false } o Numbers : { 0, 1, 2,, , 1/3, e, } o Strings : { a, abc, some words, } Special atomic value types o null: { null } o undefined: { undefined } 53

54 Javascript Compound Value Types Compound types (types that are built from primitive operators ) o Arrays : - a list of values - values are referred to by their order (first, second, third, etc.) o Maps : [100, 200, 300] The value of pos 0 The value of pos 2 - a list of (key, value) pairs { a : 100, b : 200 } - values are referred to by their keys The value of key b 54

55 Javascript Value Types This is an inductive definition: Atomic : boolean, number, string, null, undefined Compound : array, map The elements of an array/map can be any Javascript data value [100, [1,2], 300] { a : 100, b : 200, c : [1,2], d : {foo : 15}, e : 500} 55

56 More on Compound Value Types in Javascript Compound values can also be constructed by invoking the appropriate constructors and mutators (functions which incrementally change a value). let arrconstructed = Array(1,2,3) arrconstructed ==> [1,2,3] let mapconstructed = {} mapconstructed.a = 1 mapconstructed.b = 2 mapconstructed 56 ==> { a: 1, b: 2 }

57 Types Introspection Different languages offer various levels of introspection / reflection to enable the analysis of the type of values at runtime, or at interpretation /compile-time. Javascript offers very minimal reflection abilities, only the type of atomic value types or the indication that it is compound (unfortunately called object) 57

58 Javascript Types Introspection console.log(typeof("a")) console.log(typeof(6)) console.log(typeof(true) ==> string number boolean let null1 = null; let undef = undefined; console.log(typeof(null1)); console.log(typeof(undef)); 58 ==> object undefined a well known error

59 Javascript Types Introspection let arr1 = [1, 2, 3], arr2 = ['a', 'b', 'c']; console.log(typeof(arr1)); console.log(typeof(arr2)); ==> object object let map1 = { a : 1, b : 2}, map2 = { 'a' : 1, 'b' : 2}; console.log(typeof(map1)); console.log(typeof(map2)); 59 ==> object object

60 Javascript Types Introspection In Javascript typeof is very limited We will see later how Typescript improves capabilities of typeof More specific reflection : let arrins = [1, 2], mapins = { a:1 } console.log(arrins instanceof Array); console.log(mapins instanceof Array); ==> true false 60

61 Javascript Compound Value Getters Compound values can be "put apart" by using getters let arrind = ["a", "b", "c", "d", "e"] console.log(arrind[0]) console.log(arrind[1]) console.log(arrind.slice(1)) console.log(arrind.slice(1,4)) ==> a b [ 'b', 'c', 'd', 'e' ] [ 'b', 'c', 'd' ] 61

62 Javascript Compound Value Getters Compound values can be "put apart" by using getters let mapind = { a : 1, b : 2 } console.log(mapind['a']) console.log(mapind.a) console.log(mapind['b']) console.log(mapind.b) ==>

63 Compound Value Getters Compound values can be "put apart" by using getters let mapkey = { a : 1, b : 2}, arrkey = ['a', 'b', 'c']; console.log(object.keys(mapkey)); console.log(object.keys(arrkey)); ==> [ 'a', 'b' ] [ '0', '1', '2' ] 63

64 Compound Value Getters for (let k in mapkey) { } console.log(`${k} has value ${mapkey[k]}`); for (let i in arrkey) { } console.log(`${i} has value ${arrkey[i]}`); 64 ==> a has value 1 b has value 2 0 has value a 1 has value b 2 has value c The `backward notation` creates interpolated strings ${expression} is replaced by the value of the expression converted to a strings

65 Variable Types in Typescript: Gradual Typing As we said: o In static languages (c++, Java) variables must typed o In dynamic languages (Javascript, Python) variables are not typed - variables are bound to values - we can inspect their values in runtime o Typescript introduces optional variable types into Javascript let typedvarnum : number = 6, typedvarstr : string = "blue", typedvarbool : boolean = true; 65

66 Summary Programming Language semantics defines the requirements for tools that manipulate programs: interpreters, compilers, debuggers etc. helps determine whether two programs are equivalent. 66

67 Summary The Operational Semantics of programming language defines the meaning of programs by mapping programs to evaluation histories. provides recursive evaluation rules for each specific syntactic construct in a programming language. 67

68 Summary Expressions in an FP language are computed into values. This process can be described as reduction. Runtime errors can be triggered when parameters of the wrong type are passed to primitives (in Scheme) or when undefined variables are accessed. Type safety guarantees at compile-time that a welltyped program will not lead to type runtime errors. 68

69 Summary Data types are defined by 2 aspects: they are sets of values and they determine which operations can be used on values. Values can be atomic (no sub-part) or compound (made up of multiple parts). 69

70 Summary Typescript adds the option of gradual typing on top of Javascript. Primitive atomic types in Typescript are number, boolean, string, undefined and null. Primitive compound types in Typescript are array and map. 70

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages www.cs.bgu.ac.il/~ppl172 Lesson 6 - Defining a Programming Language Bottom Up Collaboration and Management - Elements of Programming Dana Fisman 1 What we accomplished

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages www.cs.bgu.ac.il/~ppl172 Lesson 4 - Type Checking Collaboration and Management Dana Fisman 1 Why declare types? Declaring types allows the compiler to detect errors

More information

CS558 Programming Languages

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

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

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages www.cs.bgu.ac.il/~ppl172 Collaboration and Management Dana Fisman Lesson 5 - Data Types and Operations on Data 1 Types - what we already know Types define sets of values

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

Denotational Semantics. Domain Theory

Denotational Semantics. Domain Theory Denotational Semantics and Domain Theory 1 / 51 Outline Denotational Semantics Basic Domain Theory Introduction and history Primitive and lifted domains Sum and product domains Function domains Meaning

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

Intro to semantics; Small-step semantics Lecture 1 Tuesday, January 29, 2013

Intro to semantics; Small-step semantics Lecture 1 Tuesday, January 29, 2013 Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 1 Tuesday, January 29, 2013 1 Intro to semantics What is the meaning of a program? When we write a program, we use

More information

Formal Semantics of Programming Languages

Formal Semantics of Programming Languages Formal Semantics of Programming Languages Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson http://www.daimi.au.dk/~bra8130/wiley_book/wiley.html Benefits of formal

More information

Formal Semantics of Programming Languages

Formal Semantics of Programming Languages Formal Semantics of Programming Languages Mooly Sagiv Reference: Semantics with Applications Chapter 2 H. Nielson and F. Nielson http://www.daimi.au.dk/~bra8130/wiley_book/wiley.html Benefits of formal

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

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Fall 2016 Lecture 3a Andrew Tolmach Portland State University 1994-2016 Formal Semantics Goal: rigorous and unambiguous definition in terms of a wellunderstood formalism (e.g.

More information

The Compiler So Far. CSC 4181 Compiler Construction. Semantic Analysis. Beyond Syntax. Goals of a Semantic Analyzer.

The Compiler So Far. CSC 4181 Compiler Construction. Semantic Analysis. Beyond Syntax. Goals of a Semantic Analyzer. The Compiler So Far CSC 4181 Compiler Construction Scanner - Lexical analysis Detects inputs with illegal tokens e.g.: main 5 (); Parser - Syntactic analysis Detects inputs with ill-formed parse trees

More information

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

Mutable References. Chapter 1

Mutable References. Chapter 1 Chapter 1 Mutable References In the (typed or untyped) λ-calculus, or in pure functional languages, a variable is immutable in that once bound to a value as the result of a substitution, its contents never

More information

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler so far

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler so far Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Statically vs. Dynamically typed languages

More information

Semantic Analysis. Lecture 9. February 7, 2018

Semantic Analysis. Lecture 9. February 7, 2018 Semantic Analysis Lecture 9 February 7, 2018 Midterm 1 Compiler Stages 12 / 14 COOL Programming 10 / 12 Regular Languages 26 / 30 Context-free Languages 17 / 21 Parsing 20 / 23 Extra Credit 4 / 6 Average

More information

CS 6110 S14 Lecture 1 Introduction 24 January 2014

CS 6110 S14 Lecture 1 Introduction 24 January 2014 CS 6110 S14 Lecture 1 Introduction 24 January 2014 1 Introduction What is a program? Is it just something that tells the computer what to do? Yes, but there is much more to it than that. The basic expressions

More information

CS112 Lecture: Primitive Types, Operators, Strings

CS112 Lecture: Primitive Types, Operators, Strings CS112 Lecture: Primitive Types, Operators, Strings Last revised 1/24/06 Objectives: 1. To explain the fundamental distinction between primitive types and reference types, and to introduce the Java primitive

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

The role of semantic analysis in a compiler

The role of semantic analysis in a compiler Semantic Analysis Outline The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

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

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

A Small Interpreted Language

A Small Interpreted Language A Small Interpreted Language What would you need to build a small computing language based on mathematical principles? The language should be simple, Turing equivalent (i.e.: it can compute anything that

More information

Pierce Ch. 3, 8, 11, 15. Type Systems

Pierce Ch. 3, 8, 11, 15. Type Systems Pierce Ch. 3, 8, 11, 15 Type Systems Goals Define the simple language of expressions A small subset of Lisp, with minor modifications Define the type system of this language Mathematical definition using

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

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

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

A Short Summary of Javali

A 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 information

Semantics via Syntax. f (4) = if define f (x) =2 x + 55.

Semantics via Syntax. f (4) = if define f (x) =2 x + 55. 1 Semantics via Syntax The specification of a programming language starts with its syntax. As every programmer knows, the syntax of a language comes in the shape of a variant of a BNF (Backus-Naur Form)

More information

1 Introduction. 3 Syntax

1 Introduction. 3 Syntax CS 6110 S18 Lecture 19 Typed λ-calculus 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic semantics,

More information

CS152 Programming Language Paradigms Prof. Tom Austin, Fall Syntax & Semantics, and Language Design Criteria

CS152 Programming Language Paradigms Prof. Tom Austin, Fall Syntax & Semantics, and Language Design Criteria CS152 Programming Language Paradigms Prof. Tom Austin, Fall 2014 Syntax & Semantics, and Language Design Criteria Lab 1 solution (in class) Formally defining a language When we define a language, we need

More information

Boolean expressions. Elements of Programming Languages. Conditionals. What use is this?

Boolean expressions. Elements of Programming Languages. Conditionals. What use is this? Boolean expressions Elements of Programming Languages Lecture 3: Booleans, conditionals, and types James Cheney So far we ve considered only a trivial arithmetic language L Arith Let s extend L Arith with

More information

CIS 194: Homework 3. Due Wednesday, February 11, Interpreters. Meet SImPL

CIS 194: Homework 3. Due Wednesday, February 11, Interpreters. Meet SImPL CIS 194: Homework 3 Due Wednesday, February 11, 2015 Interpreters An interpreter is a program that takes another program as an input and evaluates it. Many modern languages such as Java 1, Javascript,

More information

In Our Last Exciting Episode

In Our Last Exciting Episode In Our Last Exciting Episode #1 Lessons From Model Checking To find bugs, we need specifications What are some good specifications? To convert a program into a model, we need predicates/invariants and

More information

COMP 181. Agenda. Midterm topics. Today: type checking. Purpose of types. Type errors. Type checking

COMP 181. Agenda. Midterm topics. Today: type checking. Purpose of types. Type errors. Type checking Agenda COMP 181 Type checking October 21, 2009 Next week OOPSLA: Object-oriented Programming Systems Languages and Applications One of the top PL conferences Monday (Oct 26 th ) In-class midterm Review

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

Chapter 3 (part 3) Describing Syntax and Semantics

Chapter 3 (part 3) Describing Syntax and Semantics Chapter 3 (part 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

More information

Lexical Considerations

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

More information

Control Flow February 9, Lecture 7

Control Flow February 9, Lecture 7 Chapter 6 Control Flow February 9, Lecture 7 Expressions A simple object Literal constant Named variable Constant Or a function applied to arguments For built-in functions we use the term operator (like

More information

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen

COP4020 Programming Languages. Functional Programming Prof. Robert van Engelen COP4020 Programming Languages Functional Programming Prof. Robert van Engelen Overview What is functional programming? Historical origins of functional programming Functional programming today Concepts

More information

Types. Type checking. Why Do We Need Type Systems? Types and Operations. What is a type? Consensus

Types. Type checking. Why Do We Need Type Systems? Types and Operations. What is a type? Consensus Types Type checking What is a type? The notion varies from language to language Consensus A set of values A set of operations on those values Classes are one instantiation of the modern notion of type

More information

Lexical Considerations

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

More information

CS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011

CS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011 CS 6110 S11 Lecture 25 Typed λ-calculus 6 April 2011 1 Introduction Type checking is a lightweight technique for proving simple properties of programs. Unlike theorem-proving techniques based on axiomatic

More information

Semantic Analysis and Type Checking

Semantic Analysis and Type Checking Semantic Analysis and Type Checking The compilation process is driven by the syntactic structure of the program as discovered by the parser Semantic routines: interpret meaning of the program based on

More information

1 Lexical Considerations

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 information

CS4215 Programming Language Implementation. Martin Henz

CS4215 Programming Language Implementation. Martin Henz CS4215 Programming Language Implementation Martin Henz Thursday 26 January, 2012 2 Chapter 4 The Language simpl In this chapter, we are exting the language epl in order to provide a more powerful programming

More information

9/21/17. Outline. Expression Evaluation and Control Flow. Arithmetic Expressions. Operators. Operators. Notation & Placement

9/21/17. Outline. Expression Evaluation and Control Flow. Arithmetic Expressions. Operators. Operators. Notation & Placement Outline Expression Evaluation and Control Flow In Text: Chapter 6 Notation Operator evaluation order Operand evaluation order Overloaded operators Type conversions Short-circuit evaluation of conditions

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 24 Thursday, April 19, 2018 1 Error-propagating semantics For the last few weeks, we have been studying type systems.

More information

10/18/18. Outline. Semantic Analysis. Two types of semantic rules. Syntax vs. Semantics. Static Semantics. Static Semantics.

10/18/18. Outline. Semantic Analysis. Two types of semantic rules. Syntax vs. Semantics. Static Semantics. Static Semantics. Outline Semantic Analysis In Text: Chapter 3 Static semantics Attribute grammars Dynamic semantics Operational semantics Denotational semantics N. Meng, S. Arthur 2 Syntax vs. Semantics Syntax concerns

More information

The Compiler So Far. Lexical analysis Detects inputs with illegal tokens. Overview of Semantic Analysis

The Compiler So Far. Lexical analysis Detects inputs with illegal tokens. Overview of Semantic Analysis The Compiler So Far Overview of Semantic Analysis Adapted from Lectures by Profs. Alex Aiken and George Necula (UCB) Lexical analysis Detects inputs with illegal tokens Parsing Detects inputs with ill-formed

More information

10/30/18. Dynamic Semantics DYNAMIC SEMANTICS. Operational Semantics. An Example. Operational Semantics Definition Process

10/30/18. Dynamic Semantics DYNAMIC SEMANTICS. Operational Semantics. An Example. Operational Semantics Definition Process Dynamic Semantics DYNAMIC SEMANTICS Describe the meaning of expressions, statements, and program units No single widely acceptable notation or formalism for describing semantics Two common approaches:

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

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

Programming Languages Third Edition

Programming Languages Third Edition Programming Languages Third Edition Chapter 12 Formal Semantics Objectives Become familiar with a sample small language for the purpose of semantic specification Understand operational semantics Understand

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter

More information

CSCE 314 Programming Languages. Type System

CSCE 314 Programming Languages. Type System CSCE 314 Programming Languages Type System Dr. Hyunyoung Lee 1 Names Names refer to different kinds of entities in programs, such as variables, functions, classes, templates, modules,.... Names can be

More information

Compilers. Type checking. Yannis Smaragdakis, U. Athens (original slides by Sam

Compilers. Type checking. Yannis Smaragdakis, U. Athens (original slides by Sam Compilers Type checking Yannis Smaragdakis, U. Athens (original slides by Sam Guyer@Tufts) Summary of parsing Parsing A solid foundation: context-free grammars A simple parser: LL(1) A more powerful parser:

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 18 Thursday, April 3, 2014 1 Error-propagating semantics For the last few weeks, we have been studying type systems.

More information

CS321 Languages and Compiler Design I Winter 2012 Lecture 13

CS321 Languages and Compiler Design I Winter 2012 Lecture 13 STATIC SEMANTICS Static Semantics are those aspects of a program s meaning that can be studied at at compile time (i.e., without running the program). Contrasts with Dynamic Semantics, which describe how

More information

Organization of Programming Languages CS3200/5200N. Lecture 11

Organization of Programming Languages CS3200/5200N. Lecture 11 Organization of Programming Languages CS3200/5200N Razvan C. Bunescu School of Electrical Engineering and Computer Science bunescu@ohio.edu Functional vs. Imperative The design of the imperative languages

More information

Fundamentals of Programming Languages

Fundamentals of Programming Languages Fundamentals of Programming Languages 1. DEFINITIONS... 2 2. BUILT-IN TYPES AND PRIMITIVE TYPES... 3 TYPE COMPATIBILITY... 9 GENERIC TYPES... 14 MONOMORPHIC VERSUS POLYMORPHIC... 16 TYPE IMPLEMENTATION

More information

On Meaning Preservation of a Calculus of Records

On Meaning Preservation of a Calculus of Records On Meaning Preservation of a Calculus of Records Emily Christiansen and Elena Machkasova Computer Science Discipline University of Minnesota, Morris Morris, MN 56267 chri1101, elenam@morris.umn.edu Abstract

More information

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS522 Programming Language Semantics

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS522 Programming Language Semantics CONVENTIONAL EXECUTABLE SEMANTICS Grigore Rosu CS522 Programming Language Semantics Conventional Semantic Approaches A language designer should understand the existing design approaches, techniques and

More information

The PCAT Programming Language Reference Manual

The 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 information

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011

CS152: Programming Languages. Lecture 11 STLC Extensions and Related Topics. Dan Grossman Spring 2011 CS152: Programming Languages Lecture 11 STLC Extensions and Related Topics Dan Grossman Spring 2011 Review e ::= λx. e x e e c v ::= λx. e c τ ::= int τ τ Γ ::= Γ, x : τ (λx. e) v e[v/x] e 1 e 1 e 1 e

More information

Introduction to Scheme

Introduction to Scheme How do you describe them Introduction to Scheme Gul Agha CS 421 Fall 2006 A language is described by specifying its syntax and semantics Syntax: The rules for writing programs. We will use Context Free

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

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

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures Dan Grossman Fall 2014 Hi! I m not Hal J I love this stuff and have taught

More information

Outline. Introduction Concepts and terminology The case for static typing. Implementing a static type system Basic typing relations Adding context

Outline. Introduction Concepts and terminology The case for static typing. Implementing a static type system Basic typing relations Adding context Types 1 / 15 Outline Introduction Concepts and terminology The case for static typing Implementing a static type system Basic typing relations Adding context 2 / 15 Types and type errors Type: a set of

More information

Programming Languages Third Edition. Chapter 7 Basic Semantics

Programming Languages Third Edition. Chapter 7 Basic Semantics Programming Languages Third Edition Chapter 7 Basic Semantics Objectives Understand attributes, binding, and semantic functions Understand declarations, blocks, and scope Learn how to construct a symbol

More information

CS558 Programming Languages

CS558 Programming Languages CS558 Programming Languages Winter 2017 Lecture 4a Andrew Tolmach Portland State University 1994-2017 Semantics and Erroneous Programs Important part of language specification is distinguishing valid from

More information

Functional Programming. Big Picture. Design of Programming Languages

Functional Programming. Big Picture. Design of Programming Languages Functional Programming Big Picture What we ve learned so far: Imperative Programming Languages Variables, binding, scoping, reference environment, etc What s next: Functional Programming Languages Semantics

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

Chapter 3: Describing Syntax and Semantics. Introduction Formal methods of describing syntax (BNF)

Chapter 3: Describing Syntax and Semantics. Introduction Formal methods of describing syntax (BNF) Chapter 3: Describing Syntax and Semantics Introduction Formal methods of describing syntax (BNF) We can analyze syntax of a computer program on two levels: 1. Lexical level 2. Syntactic level Lexical

More information

LECTURE 16. Functional Programming

LECTURE 16. Functional Programming LECTURE 16 Functional Programming WHAT IS FUNCTIONAL PROGRAMMING? Functional programming defines the outputs of a program as a mathematical function of the inputs. Functional programming is a declarative

More information

Operators and Expressions

Operators and Expressions Operators and Expressions Conversions. Widening and Narrowing Primitive Conversions Widening and Narrowing Reference Conversions Conversions up the type hierarchy are called widening reference conversions

More information

OBJECT ORIENTED SIMULATION LANGUAGE. OOSimL Reference Manual - Part 1

OBJECT ORIENTED SIMULATION LANGUAGE. OOSimL Reference Manual - Part 1 OBJECT ORIENTED SIMULATION LANGUAGE OOSimL Reference Manual - Part 1 Technical Report TR-CSIS-OOPsimL-1 José M. Garrido Department of Computer Science Updated November 2014 College of Computing and Software

More information

This book is licensed under a Creative Commons Attribution 3.0 License

This 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 information

COS 320. Compiling Techniques

COS 320. Compiling Techniques Topic 5: Types COS 320 Compiling Techniques Princeton University Spring 2016 Lennart Beringer 1 Types: potential benefits (I) 2 For programmers: help to eliminate common programming mistakes, particularly

More information

Static semantics. Lecture 3-6: Semantics. Attribute grammars (2) Attribute grammars. Attribute grammars example. Dynamic semantics

Static semantics. Lecture 3-6: Semantics. Attribute grammars (2) Attribute grammars. Attribute grammars example. Dynamic semantics Lecture 3-6: Semantics Static semantics Attribute grammars Dynamic semantics Denotational semantics: semantic equations Axiomatic semantics: inference rules and correctness proofs Static semantics Semantics

More information

Type Checking and Type Equality

Type Checking and Type Equality Type Checking and Type Equality Type systems are the biggest point of variation across programming languages. Even languages that look similar are often greatly different when it comes to their type systems.

More information

CSE 12 Abstract Syntax Trees

CSE 12 Abstract Syntax Trees CSE 12 Abstract Syntax Trees Compilers and Interpreters Parse Trees and Abstract Syntax Trees (AST's) Creating and Evaluating AST's The Table ADT and Symbol Tables 16 Using Algorithms and Data Structures

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

Crafting a Compiler with C (II) Compiler V. S. Interpreter

Crafting a Compiler with C (II) Compiler V. S. Interpreter Crafting a Compiler with C (II) 資科系 林偉川 Compiler V S Interpreter Compilation - Translate high-level program to machine code Lexical Analyzer, Syntax Analyzer, Intermediate code generator(semantics Analyzer),

More information

FP Foundations, Scheme

FP Foundations, Scheme FP Foundations, Scheme In Text: Chapter 15 1 Functional Programming -- Prelude We have been discussing imperative languages C/C++, Java, Fortran, Pascal etc. are imperative languages Imperative languages

More information

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Semantics

CONVENTIONAL EXECUTABLE SEMANTICS. Grigore Rosu CS422 Programming Language Semantics CONVENTIONAL EXECUTABLE SEMANTICS Grigore Rosu CS422 Programming Language Semantics Conventional Semantic Approaches A language designer should understand the existing design approaches, techniques and

More information

CS 242. Fundamentals. Reading: See last slide

CS 242. Fundamentals. Reading: See last slide CS 242 Fundamentals Reading: See last slide Syntax and Semantics of Programs Syntax The symbols used to write a program Semantics The actions that occur when a program is executed Programming language

More information

LECTURE 17. Expressions and Assignment

LECTURE 17. Expressions and Assignment LECTURE 17 Expressions and Assignment EXPRESSION SYNTAX An expression consists of An atomic object, e.g. number or variable. An operator (or function) applied to a collection of operands (or arguments)

More information

Operational Semantics of Cool

Operational Semantics of Cool Operational Semantics of Cool Key Concepts semantics: the meaning of a program, what does program do? how the code is executed? operational semantics: high level code generation steps of calculating values

More information

CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages CS 314 Principles of Programming Languages Lecture 15: Review and Functional Programming Zheng (Eddy) Zhang Rutgers University March 19, 2018 Class Information Midterm exam forum open in Sakai. HW4 and

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 1 Professional Program: Data Administration and Management JAVASCRIPT AND JQUERY: AN INTRODUCTION (WEB PROGRAMMING, X452.1) WHO

More information

Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1

Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1 Natural Semantics Goals: Define the syntax of a simple imperative language Define a semantics using natural deduction 1 1 Natural deduction is an instance of first-order logic; that is, it is the formal

More information

The Untyped Lambda Calculus

The Untyped Lambda Calculus Resources: The slides of this lecture were derived from [Järvi], with permission of the original author, by copy & x = 1 let x = 1 in... paste or by selection, annotation, or rewording. [Järvi] is in turn

More information

Weiss Chapter 1 terminology (parenthesized numbers are page numbers)

Weiss 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 information

Functional Programming

Functional Programming Functional Programming CS331 Chapter 14 Functional Programming Original functional language is LISP LISt Processing The list is the fundamental data structure Developed by John McCarthy in the 60 s Used

More information

The SPL Programming Language Reference Manual

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

More information

CSCI-GA Scripting Languages

CSCI-GA Scripting Languages CSCI-GA.3033.003 Scripting Languages 12/02/2013 OCaml 1 Acknowledgement The material on these slides is based on notes provided by Dexter Kozen. 2 About OCaml A functional programming language All computation

More information