Giter Site home page Giter Site logo

stargazer's Introduction

Stargazer: A π-calculus simulator

This is a JavaScript, D3.js powered simulator for the π-calculus, a process algebra modelling concurrency and mobility.

I am releasing it for didactic purposes.

License License

Stargazer by Emanuele D'Osualdo is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

I would appreciate if you contacted me before using the simulator in presentations/other material. Note that the current version is experimental and distributed as is. A new, open-sourced version will be released at some point.

Usage

You can use the syntax of π-calculus with the ascii notation:

  • Actions α.P
    • Output: x<y1,...,yn>.P
    • Input: x(y1,...,yn).P
    • Internal: tau.P
  • The inactive process: 0 or zero (it can be omitted after an action: α.zero can be abbreviated α)
  • Parallel: P | Q
  • Guarded Sum (M): α1.P1 + … + αn.Pn
  • Process call: P[y1,...,yn]
  • Restriction: new y1,...,yn.P
  • Process definition: P[y1,...,yn] := M

Parentheses can be used to group actions, for example: x(y).x(z) + x<a> is different from x(y).(x(z) + x<a>).

Your program should have the form

INIT
DEFS

Where INIT is a process and DEFS is a sequence of definitions.

You should write normalised programs: the initial term should not contain sums and only the top-level of each definition should be a sum. For example:

new x,y.(A[x] | B[x,y])
A[x] := x(u).new z.(A[u] | B[u,x] | C[z,u])
B[x,y] := x<y>

is normalised, but

new x,y.(A[x] | x<y>)
A[x] := new z.x(u).(A[u] | u<x>| C[z,u])

is not since the initial term contains a sum x<y>, and so does the continuation in the definition of A[x]. Moreover the definition of A[x] contains a restriction at top level which is not allowed: if you need it there, move it outside in the call of A[x], otherwise consider if you meant to use it under a prefix.

Process calls A[x] where A is not defined, will be treated as if the definition was A[x] := 0.

Another important restriction: the free names of the body of a definition have to be bound by the definition's head! This means that the definition A[x] := x(y).(z<y> | A[y]) is not valid because z occurs free in the body but is not in the argument list. To fix the definition you have to include it as in A[x,z] := x(y).(z<y> | A[y,z]).

Examples

You can find an example suite of π-calculus programs at http://gist.github.com/bordaigorl/6e54093b297c0f9df01d0c82f65b89f6

Any Gist can be loaded in Stargazer by using the gist parameter. For example, to try the above Gist you can go to

http://stargazer.emanueledosualdo.com?gist=6e54093b297c0f9df01d0c82f65b89f6

You can create your own Gist and open it in the same way. A Gist can contain any number of programs (with extension .pi), each accompanied by an optional JSON configuration file with the same name but extension .json.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.