Actors Make Better Observers

Category: Uncategorized

The Observer pattern causes temporal coupling in systems with synchronous message passing. This can lead to failure in Object-Oriented systems. Asynchronous messaging avoids the pitfalls. Actor-based implementations more accurately realize the original intent of the pattern. The intent of the Observer pattern is to “define a one-to-many dependency between objects so that when one object […]

Continue reading » 3 Comments

Parsing Expression Grammars, part 4

Category: Uncategorized

This article could probably be called “Left Recursion Considered Harmful“. PEG parsers are unambiguous and relatively easy to reason about. A little reasoning about left-recursive PEGs shows that they don’t make sense. The motivation to use left recursion seems to be driven by the desire to build left-associative parse-trees for arithmetic operators. However, parse-tree generation […]

Continue reading » 2 Comments

Parsing Expression Grammars, part 3

Category: Uncategorized

We build on the parsers from part 2 of this series to enhance and extend their capability. In particular, we extend the concept of modular grammars to construct chains of parsers which define a multi-stage transformation pipeline. The parsers forming these chain are enhanced to match and transform tree-structures, rather than being limited to simple […]

Continue reading » No comments

Parsing Expression Grammars, part 2

Category: Uncategorized

It’s usually not enough to simply recognize patterns in an input stream. Soon we will want to take action based on what we recognize. In order to facilitate this, we will begin creating semantic values from the input tokens and trigger semantic actions when certain patterns are recognized. In part 1 of this series we […]

Continue reading » 2 Comments

Parsing Expression Grammars, part 1

Category: Uncategorized

Parsing Expression Grammars (PEGs) define a powerful class of matchers for recognizing strings of a formal language [1]. They’re well suited to parsing the syntax of computer languages. PEG-based tools like OMeta [2] have been successfully applied to a wide variety of transformation problems [3] [4]. The fundamental elements of PEGs can be described compactly […]

Continue reading » 2 Comments

Playing the Stooge with Humus

Category: Uncategorized

Happy New Year and welcome to 2011. With the coming of the new year, I’m happy to announce the availability of a simulator/debugger environment for Humus, currently hosted at http://dalnefre.com/humus/sim/humus.html Please note that this is a simulator of the Humus language written in JavaScript, so it runs very slowly. It is intended to allow experimentation […]

Continue reading » 1 Comment

Evaluating Expressions, part 7 – Transactions and Exceptions

Category: Uncategorized

In part 7 of our series implementing programming language constructs with actors, we implement parallel execution of block statements. Parallel execution motivates the use of single-assignment data-flow variables. We also introduce transactions and exception handling. The only extension required to our grammar from part 6 is the inclusion of a THROW statement: stmt ::= ‘LET’ […]

Continue reading » 1 Comment

Evaluating Expressions, part 6 – Actor Primitives

Category: Uncategorized

In part 6 of our series implementing programming language constructs with actors, we explore meta-circular definition of imperative actor primitives. We have now moved beyond expressions which yield values, and focus on statements which cause effects. The constructs explored here are the heart of any actor-based system. In order to support actor primitive statements, our […]

Continue reading » 5 Comments

Evaluating Expressions, part 5 – Recursion

Category: Uncategorized

Some language environments provide an interactive interface called a Read-Eval-Print-Loop (abbreviated REPL). One key characteristic of a REPL is the ability to incrementally define, extend and re-define your environment. This is particularly challenging in a pure-functional context, such as the evaluator we have developed so far. Modularity and incremental development seems to imply the need […]

Continue reading » 3 Comments

Evaluating Expressions, part 4 – Pattern Equations

Category: Uncategorized

In part 4 of our series implementing programming language constructs with actors, we extend our pattern matching behaviors to support pattern equations. These are true equations that express relationships between patterns. They form the basis for introducing LET and IF expressions. The grammar for our extended language is shown below. Changes from part 3 are […]

Continue reading » 6 Comments

Evaluating Expressions, part 3 – Pairs and Parallelism

Category: Uncategorized

In part 3 of our series implementing programming language constructs with actors, we explore parallel evaluation of sub-expressions and introduce pairs.  Pairs allow the construction of tuples, generalizing structured multi-part patterns and values. In order to support pair expressions and patterns, we’ve refactored the grammar from part 2 to separate out literal constants expressions and […]

Continue reading » 5 Comments

Evaluating Expressions, part 2 – Conditional Special Form

Category: Uncategorized

We continue exploring actor implementation of programming language constructs by adding a special form for conditional expressions. This will not increase the expressive power of the language. In part 1 we implemented a Turing-complete pure untyped lambda calculus. Now we add direct efficient support for conditional expressions and introduce basic pattern matching. Changes from the […]

Continue reading » 3 Comments

Evaluating Expressions, part 1 – Core Lambda Calculus

Category: Uncategorized

One of the best ways to understand programming language constructs is to implement them. We will begin by implementing a simple, yet Turing-complete, functional expression language.  In subsequent articles, we will extend this language with additional features.  For now we will focus on just the “untyped” lambda calculus, augmented with constants. The grammar for our expression […]

Continue reading » 5 Comments

“Dining Philosophers” in Humus

Category: Uncategorized

The “Dining Philosophers” problem is a classic example used to illustrate various challenges with concurrency. We will approach this problem by incrementally designing the actors which model the problem and its solution in Humus. Through this example we will explore the avoidance of deadlock and starvation in the design of actor-based systems. Basic Thinking/Eating Cycle […]

Continue reading » 2 Comments

Message Passing, part 2 – Object-Oriented Method Invocation

Category: Uncategorized

This is part two of an article exploring what we mean when we say “message-passing”. Part one described how synchronous rendezvous can be expressed with actors. Part two describes an actor implementation of object-oriented method invocation. For Object-Oriented developers from the Smalltalk tradition, message-passing involves a dynamic method lookup, invocation of that method with the target […]

Continue reading » 2 Comments

Message Passing, part 1 – Synchronous Rendezvous

Category: Uncategorized

What do we mean when we say “message-passing”. For Object-Oriented developers from the Smalltalk tradition, message-passing involves a dynamic method lookup, invocation of that method with the target object as an implicit parameter, and return of a result object. By contrast, message-passing in synchronous communication models (such as π-calculus) involves “rendezvous” between sender and receiver, […]

Continue reading » 3 Comments

Actors in Clojure — Why Not?

Category: Uncategorized

In his article about state management in Clojure, Rich Hickey discusses his reasons for choosing not to use the Erlang-style actor model. While Erlang has made some implementation choices that can lead to problems, the problems are not intrinsic to the Actor Model. As the actor implementation with the longest history of success, Erlang naturally represents […]

Continue reading » 14 Comments

Solving “Same Fringe” with Stream Generators

Category: Uncategorized

A classic problem in concurrent programming is known as the “same fringe” problem [1]. What is the same fringe problem? As described by Richard Gabriel [2]: The samefringe problem is this: two binary trees have the same fringe if they have exactly the same leaves reading from left to right. There are many different approaches […]

Continue reading » 8 Comments

Composing Actors

Category: Uncategorized

A significant challenge in developing concurrent systems is the problem of composability. We create a solution that works properly in isolation, but when composed with other solutions leads to interference. The actor model ensures that individual actors may be composed without changing their behavior. Interference is prevented by definition, keeping the system consistent. In order […]

Continue reading » 13 Comments

Deconstructing the Actor Model

Category: Uncategorized

The Actor Model of Computation, as defined by Carl Hewitt [1] and elaborated by Gul Agha [2], defines three primitive operations. These operations are “Send”, “Create” and “Become”. The “Send” operation transmits an asynchronous message to a known receiver. The “Create” operation constructs a new actor with a specified initial behavior. The “Become” operation defines […]

Continue reading » 6 Comments