Giter Club home page Giter Club logo

habs's Introduction

ABS Tools

compile GitHub release Gitter

Inside this repository we develop the core tools of the ABS modelling language. The current language manual is at https://abs-models.org/manual/.

To compile the command-line compiler and manual, run ./gradlew assemble (See https://abs-models.org/getting_started/local-install/ for more information).

To run the ABS collaboratory (a browser-based IDE for ABS) locally using Docker, execute the following command:

docker run -p 8080:80 --rm abslang/collaboratory:latest

Then connect your browser to http://localhost:8080/. It is not necessary to clone the repository or compile the toolchain to run the ABS collaboratory in this way.

To run the absc compiler locally using docker, create a script such as https://github.com/abstools/abstools/blob/master/frontend/src/main/resources/bash/absc-docker and put it in your path.

Folders

  • frontend - the ABS compiler and runtime support. See https://abs-models.org/getting_started/local-install/ for installation instructions.

  • abs-docs - the ABS language manual, available online at http://abs-models.org/manual/. To generate the manual locally, run make manual.

    • abs-docs/ReferenceManual - an older LaTeX ABS reference manual, now mostly of historical interest

    • abs-docs/Ott - a formal grammar for a large subset of ABS, written in Ott

  • org.abs-models.releng - Files used by Jenkins and Buckminster for continuous integration at https://envisage.ifi.uio.no:8080/jenkins/.

  • abs-unit - demonstration, description and initial ideas about the ABSUnit (a unit testing framework for ABS) (with Maven dependencies management)

  • various leftovers from previous projects, to be evaluated and reactivated or pruned

Note for Windows Users

Please clone the archive without line ending conversion (unfortunately activated by default on Windows). Use -c core.autocrlf=false as argument for the initial git clone command, i.e.,

git clone https://github.com/abstools/abstools -c core.autocrlf=false

Otherwise, running the tools inside Docker will fail with obscure error messages.

Working with the repository

Consider rebasing instead of merging your changes:

git pull --rebase

This avoids spurious "merge branch to master" commits.

git pull --rebase will, in case both you and the remote repository have new commits, replay your local commits on top of upstream changes instead of adding a new local commit that merges the master and origin/master branches. Conflicts have to be resolved per patch (via git add + git rebase --continue) instead of in one go, but we get a cleaner history.

habs's People

Contributors

bezirg avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

habs's Issues

Token Ring Algorithm does not work for the Haskell backend

The code below is my attempt at implementing the Token Ring Algorithm. Only two nodes can access the resources after which the program terminates. The await statements were used to force Haskell to execute the statements. It works for the Erlang backend so I am guessing the issue is with the Haskell backend.

`module TokenRingMod;

def Int numNodes() = 10;

interface Node {
Unit setNextNode(Node n);
Unit setTokenAtt();
}

interface Server{
Unit resources(Int id);
}

class ServerImpl implements Server{
Unit resources(Int id){
println("resources accessed by node: " + toString(id));

}
}

class NodeImpl(Int id, Server s) implements Node {

Node next;
Bool hasToken = False;
Unit run(){
if(hasToken == False){
await hasToken == True;
s!resources(id);
hasToken = False;
await next!= null;
await next!setTokenAtt();
}
}

Unit setNextNode(Node n) {
next = n;
}

Unit setTokenAtt(){
this.hasToken = True;
await this.hasToken == False;
}
}

{
List nodes = Nil;
Int num = numNodes();
Server s = new ServerImpl();
Node nextNode;
Node n;
Node first;

first = new NodeImpl(0, s);
nextNode = first;
Int id = num-1;
while (id > 0) {
n = new NodeImpl(id, s);
n!setNextNode(nextNode);
nextNode = n;
nodes = Cons(n,nodes);
id = id -1;
}
assert first != null;
first!setNextNode(n);
await first!setTokenAtt();

}`

Re-assignment of method parameters

Example code:

module Test;
class C {
  Unit m(Int x) {
    x=x+1;
  }
}

Not a big problem, because in general it is considered bad practice; even in certain OO languages (OCaml,Scala) it is disallowed.

It could possibly be fixed by generating extra local variables on the method body, but it is redundant when it is not needed, and makes generation of distributed method calls easier.

Ordering for Futures and Objects

For performance reasons, I do not provide Ord instances for Futures and Objects, e.g.:

{
 Fut<Unit> f1;
 Fut<Unit> f2;
 f1 == f2; // this is fine
 f1 < f2; // cannot compile
}

This means that futures and objects cannot be stored in fast Sets or being keys of fast Maps (elements are fine).

Could be potentially fixed by attaching to the future or object a thread-safe counter.

Equality for Futures&Objects is only provided.

Remote method call with more than one parameter causes error

DisPAck_explicit.txt

The attached habs code makes an error which is not logical. The line of code which generates the error is:

w!requests(tmp2 , tmp3,  1, workerId-1);

Some clues:

  1. You can asynchronously call the w!request(Int) without problem.
  2. If you drop the parameters of the requests() (at its calling point, its definition, and its signature in the interface) then it does not cause error anymore

Fut<A> should have covariant subtyping (right now it is invariant)

Example code that does not typecheck with habs:

module Test4;

data List_<A> = Nil_
              | Cons_(A,List_<A>);

interface I {
  I m();
}

interface I_ extends I {
  I_ m_();
}

class C implements I {
  I m() {
    return this;
  }
}

class C_ implements I_ {
 I m() {
   return this;
 }
 I_ m_() {
   return this;
 }
}

{
 I o = new local C();
 I_ o_ = new local C_();

 Fut<I_> f_ = o_!m_();

 Fut<I> f = f_; // covariant Future breaks

 // or Fut<I_> f_ = o_!m_();
 
}

Compiler bugs

There are two ABS files I am working on at the moment. I get the Irrefutable pattern error once I try to compile them with habs.

  1. DisPA_Formal.abs which causes the following error:
habs: src/ABS/Compiler/Codegen/Stm.hs:(1067,19)-(1069,93): Irrefutable pattern failed for pattern Just (SV symbolType
                                                             _)
  1. DisPAPack.abs which causes the following error:
habs: src/ABS/Compiler/Codegen/Dec.hs:(174,40)-(176,113): Irrefutable pattern failed for pattern Just (SV symbolType
                                                            _)

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.