The Caltrop Actor Language Johan Eker UC Berkeley MoBIES group, Carnegie Mellon, November 30, 2001.

Slides:



Advertisements
Similar presentations
Vilmos Zsombori , Shanghai
Advertisements

Introduction to Compilation of Functional Languages Wanhe Zhang Computing and Software Department McMaster University 16 th, March, 2004.
ANTLR in SSP Xingzhong Xu Hong Man Aug Outline ANTLR Abstract Syntax Tree Code Equivalence (Code Re-hosting) Future Work.
Chapter 16: Exception Handling C++ Programming: From Problem Analysis to Program Design, Fifth Edition.
Rule Based Operational Semantics Specification in Ptolemy Yanwar Asrigo COMP 763B - Modeling and Simulation Based Design 30 th April 2008.
A code generator for the CAL actor language Lars Wernli Supervisor: Joern Janneck, UC Berkeley Professor: Lothar Thiele, ETH Zuerich.
DATAFLOW PROCESS NETWORKS Edward A. Lee Thomas M. Parks.
Component Technologies for Embedded Systems Johan Eker.
7th Biennial Ptolemy Miniconference Berkeley, CA February 13, 2007 Causality Interfaces for Actor Networks Ye Zhou and Edward A. Lee University of California,
5 th Biennial Ptolemy Miniconference Berkeley, CA, May 9, 2003 Java Code Generation Steve Neuendorffer UC Berkeley.
Type System, March 12, Data Types and Behavioral Types Yuhong Xiong Edward A. Lee Department of Electrical Engineering and Computer Sciences University.
Department of Electrical Engineering and Computer Sciences University of California at Berkeley Behavioral Types for Actor-Oriented Design Edward A. Lee.
1 Scheme Scheme is a functional language. Scheme is based on lambda calculus. lambda abstraction = function definition In Scheme, a function is defined.
5 th Biennial Ptolemy Miniconference Berkeley, CA, May 9, 2003 C AL - An actor language Jörn W. Janneck The Ptolemy Group University of California, Berkeley.
Heterogeneous Modeling and Design in Ptolemy II Johan Eker UC Berkeley with material courtesy of Edward Lee and the Ptolemy group ECE Seminar Series, Carnegie.
3/12/ Modeling and controlling the Caltech Ducted Fan Vehicle Steve Neuendorffer, Ptolemy Group, UC Berkeley.
The Ptolemy Group University of California at Berkeley Jörn W. Janneck Actors, actor composition, and an actor language describing the semantics of (some)
Reference Book: Modern Compiler Design by Grune, Bal, Jacobs and Langendoen Wiley 2000.
Dataflow Process Networks Lee & Parks Synchronous Dataflow Lee & Messerschmitt Abhijit Davare Nathan Kitchen.
MoBIES PI-Meeting, July 2001, Jackson Hole Controller Design Using Multiple Models of Computation Edward Lee Johan Eker with thanks to Paul Griffiths,
Department of Electrical Engineering and Computer Sciences University of California at Berkeley Concurrent Component Patterns, Models of Computation, and.
MoBIES Working group meeting, September 2001, Dearborn Ptolemy II The automotive challenge problems version 4.1 Johan Eker Edward Lee with thanks.
ANTLR.
Speaking Bluntly about SharpHDL: Some Old Stuff and Some Other Proposed Future Extensions Gordon J. Pace & Christine Vella Synchron’05 Malta, November.
Lambdas and Streams. Functional interfaces Functional interfaces are also known as single abstract method (SAM) interfaces. Package java.util.function.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Java Programming Introduction & Concepts. Introduction to Java Developed at Sun Microsystems by James Gosling in 1991 Object Oriented Free Compiled and.
CSC 338: Compiler design and implementation
Compiler Phases: Source program Lexical analyzer Syntax analyzer Semantic analyzer Machine-independent code improvement Target code generation Machine-specific.
Lexical Analysis - An Introduction. The Front End The purpose of the front end is to deal with the input language Perform a membership test: code  source.
Lexical Analysis - An Introduction Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at.
Functional Programming and Lisp. Overview In a functional programming language, functions are first class objects. In a functional programming language,
Lexical Analysis (I) Compiler Baojian Hua
Lexical Analysis I Specifying Tokens Lecture 2 CS 4318/5531 Spring 2010 Apan Qasem Texas State University *some slides adopted from Cooper and Torczon.
Group 4 Java Compiler Group Members: Atul Singh(Y6127) Manish Agrawal(Y6241) Mayank Sachan(Y6253) Sudeept Sinha(Y6483)
Semantics. Semantics is a precise definition of the meaning of a syntactically and type-wise correct program. Ideas of meaning: –Operational Semantics.
Review: Compiler Phases: Source program Lexical analyzer Syntax analyzer Semantic analyzer Intermediate code generator Code optimizer Code generator Symbol.
CPS 506 Comparative Programming Languages Syntax Specification.
Design Languages in 2010 Chess: Center for Hybrid and Embedded Software Systems Edward A. Lee Professor UC Berkeley Panel Position Statement Forum on Design.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
Compiler Construction By: Muhammad Nadeem Edited By: M. Bilal Qureshi.
Actor Oriented Programming with CAL -designing embedded system components Johan Eker Department of Automatic Control, Lund University Chris Chang, Jörn.
1 Compiler & its Phases Krishan Kumar Asstt. Prof. (CSE) BPRCE, Gohana.
Chapter 15: Exception Handling C++ Programming: Program Design Including Data Structures, Fifth Edition.
An Attribute Grammar for Tiny Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 18.
Static Techniques for V&V. Hierarchy of V&V techniques Static Analysis V&V Dynamic Techniques Model Checking Simulation Symbolic Execution Testing Informal.
CSC 4181 Compiler Construction
LECTURE 3 Compiler Phases. COMPILER PHASES Compilation of a program proceeds through a fixed series of phases.  Each phase uses an (intermediate) form.
Gates AND, OR, NOT NAND, NOR Combinational logic No memory A set of inputs uniquely and unambiguously specifies.
Overview of Compilation Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 2.
PZ02CX Programming Language design and Implementation -4th Edition Copyright©Prentice Hall, PZ02CX - Perl Programming Language Design and Implementation.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
Review A program is… a set of instructions that tell a computer what to do. Programs can also be called… software. Hardware refers to… the physical components.
ACOE161Digital Circuit Design1 Design Of Combinational Logic Circuits.
Objective of the course Understanding the fundamentals of the compilation technique Assist you in writing you own compiler (or any part of compiler)
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Lexical and Syntax Analysis
Perl Programming Language Design and Implementation (4th Edition)
PROGRAMMING LANGUAGES
Functional Processing of Collections (Advanced)
CS 536 / Fall 2017 Introduction to programming languages and compilers
Basic Program Analysis: AST
Review: Compiler Phases:
Concurrent Models of Computation for Embedded Software
Lecture 4: Lexical Analysis & Chomsky Hierarchy
Compiler design.
Jörn W. Janneck The Ptolemy Group University of California, Berkeley
The Caltrop Actor Language a short introduction
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Presentation transcript:

The Caltrop Actor Language Johan Eker UC Berkeley MoBIES group, Carnegie Mellon, November 30, 2001

What is an Actor? Input & output ports States Parameters Consumes and produces tokens An actor is said to be fired

Why Another Language? Java is current practice –No need to learn another language –The functional behavior of the actor is mixed with platform issues –Most of the actor code deals with administration Caltrop offers a concise, more abstract description –Simplifies code generation –Allows some analysis –Quick to implement actors, “throw away actors” –Protects IP - Insulates the actor from the platform

Caltrop Actor Language Imperative, but with a functional flavor Embedded in a host language –All data types are imported Operates on token streams A:[1,2,3,...], B: [1,2,3,...] C: [2,4,6,...] actor Add () double A, double B  double C: action [a], [b]  [c]: c := a + b; end

Type Polymorphism Type parameters Type lattice not part of the language Operators are injected from the environment Type checking and/or type inference actor Add [T1, T2]() T1 A, T1 B  T2 C: where T2 > T1: action [a], [b]  [a+b]: end end

Actions and Patterns Matches patterns on input ports –Assume the following sequence on both ports [1,2,3,4,5,....], the output would then be the sequence [1+2+1,3+4+2,...]=[4,9,14,...] The pattern binds a and b to the two first tokens, and c to the rest of the input sequence actor MyActor () double A, double B  double C: action [a, b], [c]  [a+b+c]: end end [a, b | c]

Actions and Patterns cont’d One actor, many actions Conditional actions actor Abs () double A  double B: action [a]  [a] where a > 0: end action [a]  [-a] where a <=0: end end actor Sum () double A, double B  double C: action [a], [b]  [a+b]: end action [a], []  [a]: end action [], [b]  [b]: end end

Multi ports A port may have several channel –A multi ports is a map from ChannelID to data type –Syntax: The Switch actor –One selector input port –One data multi input port actor Switch [T] () int i, multi T input  T out: action [i], [a] i  [a]: end end

Multi ports cont’d actor Add [T] () multi T input  T out: action [a] any  [sum] with T sum := 0: foreach int i in dom a : sum := sum + a[i]; end action [a] {1,2,3}  [sum] with T sum := 0: foreach int i in dom a : sum := sum + a[i]; end

Behavior polymorphism The semantics for Caltrop is not complete Different interpretation for different targets, i.e. the same Caltrop block will have different meaning in Simulink and Ptolemy II/SDF. For example: actor MyActor () int in1, int in2  int out: action [a], [b]  [a+b]: end action [a], []  [2*a]: end action [], [b]  [2*b]: end end

Analysis Production and consumption rates may be extracted by inspection of patterns actor MyActor () int in1, int in2  int out1, int out2: a1: action [a], [b]  [a], [b]: end a2: action [a], []  [a, a], []: end a3: action [], [b]  [], [b, b]: end 

Composing Caltrop Actors

Behavioral Restrictions Restrict the allowed actions Regular expressions over actions The first action must be a1 which then is followed by either a2 or a3 zero or more times actor MyActor () int in1, int in2  int out1, int out2: a1: action [a], [b]  [a], [b]: end a2: action [a], []  [a, a], []: end a3: action [], [b]  [], [b, b]: end selector a1 (a2|a3)* end

The Rest of Caltrop Expressions are side effect free Lambda closures Statements – foreach –while –if-then-else Built-in types: list, map, set

Current Status 2 Post-docs + 2 graduate students Compiler and interpreter in the works