Distributed Meta- Programming Rui Shi, Chiyan Chen and Hongwei Xi Boston University.

Slides:



Advertisements
Similar presentations
Type Checking, Inference, & Elaboration CS153: Compilers Greg Morrisett.
Advertisements

Tim Sheard Oregon Graduate Institute Lecture 8: Operational Semantics of MetaML CSE 510 Section FSC Winter 2005 Winter 2005.
March 4, 2005Susmit Sarkar 1 A Cost-Effective Foundational Certified Code System Susmit Sarkar Thesis Proposal.
1 Programming Languages (CS 550) Lecture Summary Functional Programming and Operational Semantics for Scheme Jeremy R. Johnson.
INF 212 ANALYSIS OF PROG. LANGS Type Systems Instructors: Crista Lopes Copyright © Instructors.
Chapter 5: Elementary Data Types Properties of types and objects –Data objects, variables and constants –Data types –Declarations –Type checking –Assignment.
Tim Sheard Oregon Graduate Institute Lecture 4: Staging Interpreters CSE 510 Section FSC Winter 2004 Winter 2004.
Chapter 6 Type Checking Section 0 Overview 1.Static Checking Check that the source program follows both the syntactic and semantic conventions of the source.
Compiler Construction
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering CSCE 330 Programming Language Structures Ch.2: Syntax and Semantics Fall 2005.
1 Meta-Programming through Typeful Code Representation Chiyan Chen and Hongwei Xi Boston University.
Safety as a Software Metric Matthias Felleisen and Robert Corky Cartwright Rice University.
Dependently Typed Pattern Matching Hongwei Xi Boston University.
ML: a quasi-functional language with strong typing Conventional syntax: - val x = 5; (*user input *) val x = 5: int (*system response*) - fun len lis =
Chapter 15 Other Functional Languages. Copyright © 2007 Addison-Wesley. All rights reserved. Functional Languages Scheme and LISP have a simple syntax.
01/17/20031 Guarded Recursive Datatype Constructors Hongwei Xi and Chiyan Chen and Gang Chen Boston University.
Functional programming: LISP Originally developed for symbolic computing Main motivation: include recursion (see McCarthy biographical excerpt on web site).
Cse321, Programming Languages and Compilers 1 6/19/2015 Lecture #18, March 14, 2007 Syntax directed translations, Meanings of programs, Rules for writing.
Chapter 6 Type Checking Section 0 Overview
10 September Implementing Staged Computation Chiyan Chen and Hongwei Xi Boston University.
Programming Language Semantics Mooly SagivEran Yahav Schrirber 317Open space html://
Distributed Meta- Programming (To appear GPCE’06) Rui Shi, Chiyan Chen and Hongwei Xi Boston University.
Type Specialisation John Hughes Chalmers University.
Semantics with Applications Mooly Sagiv Schrirber html:// Textbooks:Winskel The.
Functional programming: LISP Originally developed for symbolic computing First interactive, interpreted language Dynamic typing: values have types, variables.
PADL041 A Typeful Approach to Object- Oriented Programming with Multiple Inheritance Chiyan Chen, Rui Shi, Hongwei Xi Computer Science Dept. Boston.
1 A Short Introduction to (Object-Oriented) Type Systems Kris De Volder.
Overview of program analysis Mooly Sagiv html://
Cormac Flanagan University of California, Santa Cruz Hybrid Type Checking.
Type-Specialized Staged Programming with Process Separation Yu David Liu, State University of New York at Binghamton Christian Skalka, University of Vermont.
Staging in Haskell What is Staging What does it Mean Using Template Haskell.
Adapted from Prof. Necula UCB CS 1641 Overview of COOL ICOM 4029 Lecture 2 ICOM 4029 Fall 2008.
Agile and Efficient Domain-Specific Languages using Multi-stage Programming in Java Mint Edwin Westbrook, Mathias Ricken, and Walid Taha.
Computer Science and Engineering College of Engineering The Ohio State University Interfaces The credit for these slides goes to Professor Paul Sivilotti.
10/16/2015IT 3271 All about binding n Variables are bound (dynamically) to values n values must be stored somewhere in the memory. Memory Locations for.
Introduction to Scheme Lectures on The Scheme Programming Language, 2 nd Ed. R. Kent Dybvig.
Chapter Twenty-ThreeModern Programming Languages1 Formal Semantics.
CSC 580 – Theory of Programming Languages, Spring, 2009 Week 9: Functional Languages ML and Haskell, Dr. Dale E. Parson.
Formal Semantics Chapter Twenty-ThreeModern Programming Languages, 2nd ed.1.
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
Chapter 3 Syntax, Errors, and Debugging Fundamentals of Java.
1 Alex Proctor and Brian Lee for CSCI 431 at UNCA, Fall 2002 ML (Meta Language) a brief introduction Alex Proctor and Brian Lee For CSCI 431 at the University.
Implementing a Dependently Typed λ -Calculus Ali Assaf Abbie Desrosiers Alexandre Tomberg.
12/9/20151 Programming Languages and Compilers (CS 421) Elsa L Gunter 2112 SC, UIUC Based in part on slides by Mattox.
Types and Programming Languages Lecture 11 Simon Gay Department of Computing Science University of Glasgow 2006/07.
How to execute Program structure Variables name, keywords, binding, scope, lifetime Data types – type system – primitives, strings, arrays, hashes – pointers/references.
Semantic Analysis II Type Checking EECS 483 – Lecture 12 University of Michigan Wednesday, October 18, 2006.
Advanced Functional Programming Tim Sheard 1 Lecture 17 Advanced Functional Programming Tim Sheard Oregon Graduate Institute of Science & Technology Lecture:
Data Types (3) 1 Programming Languages – Principles and Practice by Kenneth C Louden.
CS7120 (Prasad)L13-1-Lambda-Opt1 Typed Lambda Calculus Adapted from Lectures by Profs Aiken and Necula of Univ. of California at Berkeley.
End of the beginning Let’s wrap up some details and be sure we are all on the same page Good way to make friends and be popular.
Day 3: The Command and Visitor Patterns. Preliminaries The Java static type system uses simple rules to infer types for Java expressions. The inferred.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
Generic Programming and Proving for Programming Language Metatheory
Operational Semantics of Scheme
Type Checking and Type Inference
Programming Languages and Compilers (CS 421)
Functional Programming
Names and Attributes Names are a key programming language feature
ML: a quasi-functional language with strong typing
6.001 SICP Compilation Context: special purpose vs. universal machines
Generics, Lambdas, Reflections
A Modality for Safe Resource Sharing and Code Reentrancy
Programming Languages and Compilers (CS 421)
Mini Language Interpreter Programming Languages (CS 550)
The Metacircular Evaluator
Lecture #6 section pages pages72-77
6.001 SICP Variations on a Scheme
Abstract Types Defined as Classes of Variables
Presentation transcript:

Distributed Meta- Programming Rui Shi, Chiyan Chen and Hongwei Xi Boston University

Outline MP vs. DMP Typeful Code Representation The Language dist The Language + dist Discussion and Conclusion

Meta-Programming (define (run code) (eval code nil)) (define (power n x) (if (= n 0) 1 `(*,x,(power (- n 1) x)))) ;;; (power 2 ‘x) yields (* x (* x 1)) (define square (run `(lambda (x),(power 2 ‘x)))) ;;; (power 3 ‘y) yields (* y (* y (* y 1))) (define cube (run `(lambda (y),(power 3 ‘y))))

Distributed Meta-Programming Cod e Run-time code generation Distributed execution

Outline MP vs. DMP Typeful Code Representation The Language dist The Language + dist Discussion and Conclusion

`(“abc” + 10) (ill-typed) `(( y.x) 10) (open code) Un-typed Code Representation No guarantee on the safety of generated code.  Code can be syntactically ill-formed or ill-typed, which lead to run-time errors when executed at remote sites.  Issues of locality and heterogeneity of resources Different sites may have different resources and thus likely to provide different services. f : (Int ! L `(f 100) L’

Typeful Code Representation (T.C.R) The types of object programs can be reflected in the types of meta programs  E.g. code of type h , T i represents an object program of type T under the type environment . The type of the code also reflects where it should be sent for execution.  E.g. code of type h L, , T i can be sent to location L for execution. The compiler can statically guarantee that only well-typed code can be constructed at run-time and sent to proper locations for execution.

Outline MP vs. DMP Typeful Code Representation The Language dist The Language + dist Discussion and Conclusion

The Language dist

First-Order Code Constructors For example, the term x. y. y (x) can be represented as: which can be of type (with static variables properly instantiated) Lam (Lam (App (One) (Shi (One)))) 8. h, , int ! (int ! int) ! int i

Some Primitive Functions

Constant Messages Constant messages refer to the messages which can be interpreted at all sites. Example: perform addition of two integers at remote site

An Example in dist f : (Int ! L `(f 100) rget int (L, rexec (L, App (Lift (n2m f)), Lift 100) )) of type h L, , int i

Outline MP vs. DMP Typeful Code Representation The Language dist The Language + dist Discussion and Conclusion

The Language + dist We extend dist to + dist with some language constructs adopted from meta-programming (supported in Scheme and MetaML):  `(e) for the code representation of e  ^(e) for spliceing the code e into some context  %(¢) is a shorthand for ^(Lift(¢))

An Example in Concrete Syntax of + dist typedef CodeType (L: loc) = int) -> int> fun rZeroFind2{L:loc} (L:loc(L)) (n: (int -> L) : int = let val zeroFindCode : CodeType (L) = `(lam f => (fix aux i => if f (i) = 0 then i else aux (i+1)) 0) in rexecInt (L, `(^zeroFindCode %(n2m n))) end

Outline MP vs. DMP Typeful Code Representation The Language dist The Language + dist Discussion and Conclusion

Discussion We have a transformation scheme from + dist to dist to justify the soundness of + dist. We have a process to elaborate programs (partial type inference) in the concrete syntax to the formal syntax of + dist DMP is implemented as a part of ATS (Applied Type System) framework.

Conclusion A simple and general approach to support typed mobile computing. Combines meta-programming with distributed programming in a coherent manner. In future, we are planning to study issues such as exception handling and distributed garbage collection in this context.

Thank You!