Skip to content

Interpreter for a Join Calculus DSL (Join-Language) backed by a DHT

License

Notifications You must be signed in to change notification settings

syallop/Join-Interpreter-Distributed

Repository files navigation

Distributed Join-Language Interpreter

This module exports a basic interpreter for Join-Language which is an attempt at encoding the join calculus within the Haskell programming language as an embedded DSL.

It is a fork of Join-Interpreter-Basic substituting the use of a centralised Name Server for a Distributed Hash Table. This functionality is used for the distributed DSLs channel registration and lookup features.

Usage

  1. Write a join program using Join-Language
  2. Call ‘run’ (from Join.Interpreter.Distributed) on the top-level process to execute it as an IO action.

Implementation details

The interpreter is a fairly quick and dirty implementation , not fully optimised and not implementing some possible features.

The primary optimisation is that definitions are compiled to bit-patterns making testing a single ‘pattern |> trigger’ a cheap bitwise operation against a status bit-pattern.

Regarding execution, Instructions are executed concurrently with respect to instructions related to separate definition blocks. ‘spawn’ and ‘with’ instructions use ‘forkIO’ and so use lightweight Haskell threads as opposed to OS threads.

Not all invalid programs are caught at compile-time by Join-Language and have undefined behavior. This interpreter behaves in the following manner:

Erroneous action Result
Sending >1 reply Silently dropped
Sending an unexpected reply Runtime error
Sync without reply Possible runtime error “Blocked on MVar”
Overlapping definition block Actions on overlapping patterns are considered on the later definition, in isolation
Channel appears >1 in single definition Will trigger as if only 1 occurrence, probably resulting in “no such message” exceptions

About

Interpreter for a Join Calculus DSL (Join-Language) backed by a DHT

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published