Hop Operational Semantics

Slides:



Advertisements
Similar presentations
Semantics Static semantics Dynamic semantics attribute grammars
Advertisements

JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
Rigorous Software Development CSCI-GA Instructor: Thomas Wies Spring 2012 Lecture 11.
Principles of programming languages 1: Introduction (with a simple language) Isao Sasano Department of Information Science and Engineering.
CSc 453 Compilers & Systems Software Saumya Debray The University of Arizona Tucson, AZ
CSE 425: Semantic Analysis Semantic Analysis Allows rigorous specification of a program’s meaning –Lets (parts of) programming languages be proven correct.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Axiomatic Semantics.
ISBN Chapter 3 Describing Syntax and Semantics.
1 Semantic Description of Programming languages. 2 Static versus Dynamic Semantics n Static Semantics represents legal forms of programs that cannot be.
CS 355 – Programming Languages
Comp 205: Comparative Programming Languages Semantics of Imperative Programming Languages denotational semantics operational semantics logical semantics.
School of Computing and Mathematics, University of Huddersfield CAS810: WEEK 3 LECTURE: LAMBDA CALCULUS PRACTICAL/TUTORIAL: (i) Do exercises given out.
Language Specfication and Implementation - PART II: Semantics of Procedural Programming Languages Lee McCluskey Department of Computing and Mathematical.
CS 290C: Formal Models for Web Software Lecture 10: Language Based Modeling and Analysis of Navigation Errors Instructor: Tevfik Bultan.
CS 330 Programming Languages 09 / 18 / 2007 Instructor: Michael Eckmann.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Operational Semantics.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
Chair of Software Engineering 1 Concurrent Object-Oriented Programming Arnaud Bailly, Bertrand Meyer and Volkan Arslan.
PSUCS322 HM 1 Languages and Compiler Design II Formal Semantics Material provided by Prof. Jingke Li Stolen with pride and modified by Herb Mayer PSU Spring.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Describing Syntax and Semantics
Dr. Muhammed Al-Mulhem 1ICS ICS 535 Design and Implementation of Programming Languages Part 1 Fundamentals (Chapter 4) Denotational Semantics ICS.
ITM352 Javascript and Dynamic Web Pages: Client Side Processing.
CSC 8310 Programming Languages Meeting 2 September 2/3, 2014.
DAT602 Database Application Development Lecture 15 Java Server Pages Part 1.
Hoare logic for higher order store using simple semantics Billiejoe (Nathaniel) Charlton University of Sussex WoLLIC 2011.
Java Server Pages Lecture July Java Server Pages Java Server Pages (JSPs) provide a way to separate the generation of dynamic content (java)
RELATIONAL FAULT TOLERANT INTERFACE TO HETEROGENEOUS DISTRIBUTED DATABASES Prof. Osama Abulnaja Afraa Khalifah
Chapter Twenty-ThreeModern Programming Languages1 Formal Semantics.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
CS 363 Comparative Programming Languages Semantics.
Copyright © Curt Hill Languages and Grammars This is not English Class. But there is a resemblance.
Formal Semantics of Programming Languages 虞慧群 Topic 1: Introduction.
CSc 453 Compilers & Systems Software Saumya Debray The University of Arizona Tucson, AZ
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
Chapter 3 Part II Describing Syntax and Semantics.
Programming Languages and Design Lecture 3 Semantic Specifications of Programming Languages Instructor: Li Ma Department of Computer Science Texas Southern.
Semantics In Text: Chapter 3.
Syntax and Semantics CIS 331 Syntax: the form or structure of the expressions, statements, and program units. Semantics: the meaning of the expressions,
Theory of Programming Languages Introduction. What is a Programming Language? John von Neumann (1940’s) –Stored program concept –CPU actions determined.
School of Computing and Mathematics, University of Huddersfield CHA2545: WEEK 4 LECTURE: DENOTIONAL SEMANTICS OF A SIMPLE LANGUAGE TUTORIAL: Do exercises.
ECSE Software Engineering 1I HO 4 © HY 2012 Lecture 4 Formal Methods A Library System Specification (Continued) From Specification to Design.
Copyright 2001, Matt Dwyer, John Hatcliff, and Radu Iosif. The syllabus and all lectures for this course are copyrighted materials and may not be used.
Programming Language Descriptions. What drives PL Development? Computers are “in charge” of extremely important issues Execute a program literally. Exercise.
Martin Kruliš by Martin Kruliš (v1.1)1.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Denotational Semantics.
CMSC 330: Organization of Programming Languages Operational Semantics.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
CSC3315 (Spring 2009)1 CSC 3315 Languages & Compilers Hamid Harroud School of Science and Engineering, Akhawayn University
C HAPTER 3 Describing Syntax and Semantics. D YNAMIC S EMANTICS Describing syntax is relatively simple There is no single widely acceptable notation or.
Prof. Necula CS 164 Lecture 171 Operational Semantics of Cool ICOM 4029 Lecture 10.
Operational Semantics Mooly Sagiv Tel Aviv University Sunday Scrieber 8 Monday Schrieber.
CS5205Semantics1 CS5205: Foundation in Programming Languages Semantics Static Semantics Dynamic Semantics Operational Semantics Big-step Small-Step Denotational.
Programming Languages Meeting 3 September 9/10, 2014.
Dr. M. Al-Mulhem Denotational Semantics 1 Chapter 4 Fundamentals (Denotational Semantics)
Software Engineering Algorithms, Compilers, & Lifecycle.
Operational Semantics of Scheme
Concepts of Programming Languages
Contents. Goal and Overview. Ingredients. The Page Model.
Describing Syntax and Semantics
Static Detection of Cross-Site Scripting Vulnerabilities
Computational Models Database Lab Minji Jo.
XML in Web Technologies
CSc 453 Compilers & Systems Software 00. Background
JavaScript an introduction.
Generic Language Technology (2IS15) Dynamic Semantics
COMP 150-IDS: Internet Scale Distributed Systems (Spring 2016)
Semantics In Text: Chapter 3.
Software Construction
Presentation transcript:

Hop Operational Semantics Paris, February 23rd Tamara Rezk Indes Team, INRIA

Hop Multi-tiers compiler Input: a web application written in a single homogenous language HOP multi-tiers compiler SQL (server) scheme code and protocols over html (server code) javascript (client code)

A precise Hop specification specifications are used to understand the meaning of programs In this lecture: a precise (mathematical) specification of the Hop programming language by means of operational semantics Unless there is a prior, generally-accepted mathematical definition of a language at hand, who is to say whether a proposed implementation is correct? (Dana Scott 1969)

Formal Semantics Denotational Semantics: programs are partial functions mapping initial states to final states (Strachey-Scott, domain theory) Dana Scott: his work on automata theory earned him turing award in 1976 Unless there is a prior, generally-accepted mathematical definition of a language at hand, who is to say whether a proposed implementation is correct? Dana Scott, Turing Award 76

Formal Semantics Axiomatic Semantics: programs are given specifications in e.g. first order logic and can be proven correct with respect to their spec. in the logic Turing award = prix turing “There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.” Tony Hoare, Turing Award 80

Formal Semantics Structural Operational Semantics (also called “Transition semantics” or “small-step semantics”) Execution of a program can be foramlized as a sequence of configurations Gordon Plotkin

Structural Operational Semantics Abstract grammar of the language Configurations and states Transition relation

Hop abstract grammar (Abstract grammars may remind to context-free/BNF grammars but abstract grammars are independent from representations such as which operators are infix, what strings are used to denote contants and variables, etc, etc)

Hop semantics We will study Hop semantics in layers: Scheme subset of Hop Distributed aspects of Hop (server+client) Document Object Model (DOM) aspects of Hop Same Origin Policy (SOP) Access Control (AC) and semantics Differentes couches

Hop semantics We will study Hop semantics in layers: Scheme subset of Hop Distributed aspects of Hop (server+client) Document Object Model (DOM)aspects of Hop Same Origin Policy (SOP) Access Control (AC) and semantics

Hop abstract grammar (Abstract grammars may remind to context-free/BNF grammars but abstract grammars are independent from representations such as which operators are infix, what strings are used to denote contants and variables, etc, etc)

1.Scheme abstract grammar program or expression e :: = x | w | (e0 e1) | (set! x e ) values w:: = (lambda (x) e) | i | ( )

Scheme abstract grammar program or expression e :: = x | w | (e0 e1) | (set! x e ) values w:: = (lambda (x) e) | i | ( ) Example programs: (lambda (z) (lambda (y) (set! y z))) ((lambda (z) ((lambda (y) (set! y z)) 2)) 3) (lambda (z) ((lambda (y) (set! y z)) 2))

Structural Operational Semantics Abstract grammar of the language Configurations and states Transition relation

Scheme configurations Abstract grammar: e :: = x | w | (e0 e1) | (set! x e ) w:: = (lambda (x) e) | i | ( ) Configurations are of the form: < e , μ > e expression μ environment or store, mapping variables to values

Scheme configurations Configurations are of the form: < e , μ > e expression μ environment or store, mapping variables to values Example of configuration: < (set! x 3), { x  2, z  4} > environment = environement store = memoire mapping = correspondence (ou fonction)

Scheme configurations μ environment or store, mapping variables to values In the store we will consider: local variables (defined by lambda expressions) global variables (already defined in the store before execution, in scheme #define ) Here explain notation dom(\mu) and give examples of how we write that: \mu = { x-> v}

Structural Operational Semantics Abstract grammar of the language Configurations and states Transition relation

Transition relation The operational semantics is defined by a transition system (configurations, ). The transition relation  is defined by a set of semantics rules of the form: constraints _______________________ <conf0 >  < conf1>

Transition relation e :: = x | w | (e0 e1) | (set! x e ) y not in dom(μ ) _______________________ <((lambda (x) e) w), μ >  < e{y/x}, μ U {y -> w} > Explain notation de substitution e :: = x | w | (e0 e1) | (set! x e ) w:: = (lambda (x) e) | i | ( )

Transition relation < y , μ >  <w , μ > y not in dom(μ ) _______________________ <((lambda (x) e) w), μ >  < e{y/x}, μ U {y -> w} > μ (y ) = w _______________________ < y , μ >  <w , μ > Explain notation de substitution

Transition relation Example of execution with 2 steps: y not in dom(μ ) _______________________ <((lambda (x) e) w), μ >  < e{y/x}, μ U {y -> w} > Example of execution with 2 steps: <((lambda (x) x) 2), {z ->3} >  < x{y/x}, {z ->3 , y -> 2} >  < 2, {z ->3 , y -> 2} > Explain notation de substitution

Transition relation y not in dom(μ ) _______________________ <((lambda (x) e) w), μ >  < e{y/x}, μ U {y -> w} > Exercise: give an execution for <( (lambda (z) (lambda (y) y)) 2), {z -> 2}> Explain notation de substitution

Transition relation y not in dom(μ ) _______________________ <((lambda (x) e) w), μ >  < e{y/x}, μ U {y -> w} > This rule is not enough: what happens if we want to reduce an application (e e’) where e’ is not a value? ((lambda (z) z) ((lambda (z) z) 3) ) We need to define contextual rules!! Explain notation de substitution

_______________________ Evaluation contexts E ::= [] | (E e) | (w E) | (set! x E) ((lambda (z) z) ((lambda (z) z) 3) ) In this example: E = ((lambda (z) z) [] ) y not in dom(μ ) _______________________ <E[((lambda (x) e) w)], μ >  < E[e{y/x}], μ U {y -> w} > Explain notation de substitution

_______________________ Evaluation contexts y not in dom(μ ) _______________________ <E[((lambda (x) e) w)], μ >  < E[e{y/x}], μ U {y -> w} > E ::= [] | (E e) | (w E) | (set! x E) <((lambda (z) z) ((lambda (z) z) 3) ), {z  2} >  <((lambda (z) z) y), {z  2, y  3} >  <((lambda (z) z) 3), {z  2, y  3} >  <((lambda (z) z) 3), {z  2, y  3, x 3} >  < x, {z  2, y  3, x 3}  < 3, {z  2, y  3, x 3} Explain notation de substitution

Transition relation for Scheme subset y not in dom(μ ) _______________________ <E[((lambda (x) e) w)], μ >  < E[e{y/x}], μ U {y -> w} > Transition relation for Scheme subset μ (y ) = w _______________________ < E[y] , μ >  <E[w] , μ > Explain notation de substitution x in dom(μ) _______________________ < E[(set! x w)] , μ >  <E[()] , μ[x-> w] >

Exercises (set! z 3) 2. (((lambda (z) (lambda (y) (set! y z))) 2) 3) Find executions for the following programs starting with store { z -> 5} (set! z 3) 2. (((lambda (z) (lambda (y) (set! y z))) 2) 3) 3. ((lambda (z) ((lambda (y) (set! y z))) 2) 3) 4. (((lambda (x) (lambda (y) (set! x z))) 2) 3) 5. (set! z ((lambda (y) y) 2)) One could also explain here the notion of derivation tree using the semantics rule, but I’ll skip for lack of time

Hop semantics We will study Hop semantics in layers: Scheme subset of Hop Distributed aspects of Hop (server+client) Document Object Model (DOM) aspects of Hop Same Origin Policy (SOP) Access Control (AC) and semantics deuxiemes couches

Hop distribution: Abstract grammar

Hop distribution: Abstract grammar

Hop distribution: Abstract grammar

Hop distribution: Abstract grammar

Hop distribution: Abstract grammar

Hop distribution: Abstract grammar E ::= [] | (E S) | (w E) | (set! x E) | (with-hop E s) | (with-hop w E)

Distribution aspects server/client

Core Hop configuration

Core Hop configuration

Core Hop configuration

Core Hop configuration

Core Hop configuration

Core Hop configuration

Core Hop configuration

Transition relation: service definition

INIT rule When a client enter a URL in a browser, the service bound to the URL will be invoked; Bound url New client instance New server thread

Hop Compilation + Init and Invoke rule Hop source Hop client code Client code compiler CSS Code Injection Prevention HTML Server code compiler Mashic Compiler JS Invoke Generate URL Server Bytecode URL Server Bytecode Access URLs URL Server Bytecode HTTP URL Server Bytecode

Transition relation: service invocation

Transition relation: service invocation exercise: Let s be (service (z) (set! z ((lambda (y) y) 2))) . Find a (partial) execution for s

Transition relation: service return

Transition relation: service invocation

Service return

Service return exercise: Let s be (service (z) (set! z ((lambda (y) y) 2))). Find an execution for s Let s be (service (z) ((lambda (y) y) 2)) . Find an execution for s Let s be (service (z) ~((lambda (y) y) 2)) . Find an execution for s

Hop semantics We will study Hop semantics in layers: Scheme subset of Hop Distributed aspects of Hop (server+client) Document Object Model (DOM) aspects of Hop Same Origin Policy (SOP) Access Control (AC) and semantics

HOP and DOM: Syntax

DOM: core Hop modified rules

Operation on DOM and contexts

HTML tags

DOM Operations

Example