GithubHelp home page GithubHelp logo

coreasm.core's Introduction

The CoreASM Modeling Framework

CoreASM is an open source project that focuses on offering a lean executable ASM (Abstract State Machines) language, in combination with a supporting tool environment for high-level design, experimental validation and formal verification (where appropriate) of abstract system models.

CoreASM offers a rich ASM language with a formally defined semantics that is faithful to the original semantics of ASM and is the first ASM tool that explicitly supports distributed ASM computation models with custom scheduling policies. The extensibility of its language and modeling environment, the most significant feature of CoreASM, provides utmost flexibility for extending its language definition and execution engine in order to tailor it to the particular needs of virtually any conceivable application context. CoreASM is one of the few ASM tools that is implemented as an open framework.

CoreASM can be used in differnt forms: it offers a modeling framework, it can be viewed as a tool suite with different tools it offers around the engine, while the engine itself can be used as an stand-alone tool (using its command-line or Eclipse plugin UI).

What is Carma?

Carma is a command-line CoreASM Engine driver. It runs CoreASM specifications using a CoreASM Engine and offers control over the engine.

How is it related to CoreASM on SourceForge?

These are the same projects. At some point in 2013 we have stopped maintaing the code on sourceforge and started moving the repository to github.

How To Build CoreASM?

You can build the CoreASM core projects using Maven. Just run the following command in org.coreasm.parent project:

mvn clean install

To build/update eclipse project files, run:

mvn eclipse:eclipse

A detailed manual how to setup an Eclipse based development environment for CoreASM can be found in our wiki .

The Latest Version

Latest released versions of Carma, CoreASM Eclipse and the CoreASM Engine can be found on github. Older versions can be found on the CoreASM Project web site http://www.coreasm.org.

Licensing

Both the Carma project and the CoreASM Engine project are licensed under the Academic Free License version 3.0 which is available from either of these web pages: http://www.opensource.org/licenses/afl-3.0.php http://www.coreasm.org/afl-3.0.php

Thanks for using Carma.

The CoreASM Development Team 2005-2013

coreasm.core's People

Contributors

araschke avatar dependabot[bot] avatar locke avatar markusbrenner avatar mdausend avatar mstegmaier avatar normanthiel avatar roozbehf avatar spellmaker avatar wolskia avatar

Stargazers

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

Watchers

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

coreasm.core's Issues

Jasmine: Impossible to invoke static methods without object instantiation

Invoking static methods requires that a JObject value of the target class be instantiated first, which should not be needed.

For example, to invoke the static method java.util.UUID.randomUUID(), one has to first create a UUID object:

import native java.util.UUID(1, 2) into xy
invoke xy->randomUUID() result into id

Perhaps we can have an invoke static that gets a full Java class name, instead of the JObject term, such that one can write:

invoke static java.util.UUID->randomUUID() result into id

filter lists depending on "environment variables"

Hi,

I need to filter lists depending on "environment variables".

I use this approach which works fine until commit 039d116:

derived environmentFilter(x) = (x > y)

rule testEnvironmentFilter = {
    let y = 7 in {
        print "testEnvironmentFilter: " + filter(myList, @environmentFilter)
    }
}

init Start

rule Start = {
    seqblock
        myList := [1, 2, 3, 4, 5, 6, 7, 8, 9, 0]
        testEnvironmentFilter()
    endseqblock
    program(self) := undef
}

Can you suggest me an alternative approach? With the hiding of environment variables I don't see any way to pass y to the function that is used by the filter.

guarded foreach stuck in endless loop

The deadlock I mentioned in #20 turned out to be a bug regarding foreach.

Somewhere between dc3753f and 49dd3ab foreach gets stuck in an endless loop if there are no elements where the with condition holds.

foreach x in [1, 2, 3] with (x > 5) do {
    print "x: " + x
}

print "done"

If you use an more complex guard containing a debuginfo you can see that it is evaluated for all elements over and over again.

Note: using an empty list works as expected

"use" statement inside multiline comment are recognized as specification errors error

Inside multi-line comments, the editor recognizes all occurrences of "...use ...." as specification errors. An error should only be indicated, if a line starts with maybe some spaces followed by a use-statement if this statement is followed by anything else -which could even be a (multi-line) comment.

For example

/* ...
* @expects
*   advice should not be executed because the ...
*/

in this case "becaUSE" triggers a wrong error message: "use" statement inside multiline comment

Not compiling CoreASM out of box?

Added coreASM to my epsilon toy box.

Copy and pasted Dining Philosophers into new *.casm file over default text.

Got:

INFO - parsing file D:\Safety\epsilon\safetyw\coreasm_sandpit\untitled.casm
org.asmeta.parser.ParseException: Encountered " <ID_DOMAIN> "CoreASM "" at line 7, column 1.
Was expecting one of:
"asm" ...
"module" ...
"asyncr" ...

at org.asmeta.parser.ASMParser.generateParseException(ASMParser.java:9365)
at org.asmeta.parser.ASMParser.jj_consume_token(ASMParser.java:9238)
at org.asmeta.parser.ASMParser.Asm(ASMParser.java:188)
at org.asmeta.parser.ASMParser.setUpReadAsm(ASMParser.java:114)
at org.asmeta.eclipse.editor.actions.ParseJob.run(ParseJob.java:77)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Tried compiling boiler plate code that comes with new file, got:

INFO - parsing file D:\Safety\epsilon\safetyw\coreasm_sandpit\untitled2.casm
org.asmeta.parser.ParseException: Encountered " <ID_DOMAIN> "CoreASM "" at line 1, column 1.
Was expecting one of:
"asm" ...
"module" ...
"asyncr" ...

at org.asmeta.parser.ASMParser.generateParseException(ASMParser.java:9365)
at org.asmeta.parser.ASMParser.jj_consume_token(ASMParser.java:9238)
at org.asmeta.parser.ASMParser.Asm(ASMParser.java:188)
at org.asmeta.parser.ASMParser.setUpReadAsm(ASMParser.java:114)
at org.asmeta.eclipse.editor.actions.ParseJob.run(ParseJob.java:77)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

Seems to not want to run from Run menu, but will run from buttons on menu bar?

Any configuration that I am missing? There appears nothing to set up other than the install?

Cheers,
A

CoreASMError: Cannot apply updates when state stack is empty

Hi,

after a minor refactoring of my specification the Engine crashs now with the CoreASMError: Cannot apply updates when state stack is empty from HashStorage.java:475 (using the current master). It also crashes in 3966cc7, but I can't test older revisions as I use foreach.

When I revert to the state before the refactoring it works fine. However I couldn't narrow down which of my edits is responsible for the crash, I'm still working on that. But even if I did something wrong in my specification the Engine should crash with a nicer message, so I assume a bug in the Engine.

Here is the stacktrace (some line numbers could be wrong as I added some logging statements):

org.coreasm.engine.CoreASMError: Cannot apply updates when state stack is empty.
    at org.coreasm.engine.Engine.error(Engine.java:632)
    at org.coreasm.engine.Engine.error(Engine.java:618)
    at org.coreasm.engine.absstorage.HashStorage.apply(HashStorage.java:486)
    at org.coreasm.engine.plugins.turboasm.TurboASMPlugin.interpret(TurboASMPlugin.java:435)
    at org.coreasm.engine.interpreter.InterpreterImp.executeTree(InterpreterImp.java:144)
    at org.coreasm.engine.scheduler.ConcurrentProgramEvaluator.evaluate(ConcurrentProgramEvaluator.java:176)
    at org.coreasm.engine.scheduler.ConcurrentProgramEvaluator.run(ConcurrentProgramEvaluator.java:115)
    at EDU.oswego.cs.dl.util.concurrent.FJTaskRunner.scanWhileIdling(Unknown Source)
    at EDU.oswego.cs.dl.util.concurrent.FJTaskRunner.run(Unknown Source)

I cannot give you the full specification, and also couldn't write a small "crashing" example / testcase.

Basicly the specification has a main loop like this:

function agentTasks : Agents -> LIST
function skipNextTasks : Agents -> BOOLEAN
function tasks : -> LIST

rule MainLoop = {
    local tasks in seqblock
        tasks := agentTasks(self)

        while (|tasks| > 0) do
        let currentTask     = head(tasks) in
        let currentTaskID   = nth(currentTask, 1) in 
        let currentTaskType = nth(currentTask, 2) in seqblock

            ExecuteTask(currentTaskID)

            if (skipNextTasks(self) = true) then {
                debuginfo MainLoop "next tasks should not be executed"
                tasks := []
            }
            else if (currentTaskType = "special") then {
                debuginfo MainLoop "only special next tasks should be executed"
                tasks := filterSpecial(tasks)
            }
            else {
                debuginfo MainLoop "continue with next tasks (unfiltered)"
                tasks := tail(tasks)
            }

            debuginfo MainLoop "next tasks: " + tasks
        endseqblock

        debuginfo MainLoop "main loop ended"
    endseqblock
}

rule Execute = seqblock
    Debug_PrintState

    MainLoop
endseqblock

Within ExecuteTask lies the complete logic like modifying agentTasks for the next iteration, and having a lot of let, foreach, while and even again local tasks in sub-rules / derived functions.

I get the debug info "next tasks: []", but then the crash occurs and "main loop ended" will not be printed.

From what I've read in HashStorage.java incremental updates (like seq, while, foreach) work with stacked states, so I've logged all calls to pushState and popState:

locke@VirtualBox:/tmp$ cat log | grep pushState | grep TurboASMPlugin | wc -l
237
locke@VirtualBox:/tmp$ cat log | grep popState | grep TurboASMPlug | wc -l
227


locke@VirtualBox:/tmp$ cat log | grep pushState | grep LetRulePlugin | wc -l
189
locke@VirtualBox:/tmp$ cat log | grep popState | grep LetRulePlugin | wc -l
193


locke@VirtualBox:/tmp$ cat log | grep pushState | grep ForeachRulePlugin | wc -l
18
locke@VirtualBox:/tmp$ cat log | grep popState | grep ForeachRulePlugin | wc -l
34

I expected these numbers to be identical or about off-by-one and hoped to find the error by myself, however I'm suprised that there are a lot more popState than pushState. So without more knowledge about the internals I'm stuck.

As I can't give a full example: can you give me some ideas how I could continue identifying the problem, or do you even see from the example and description what went wrong?

Compiler: derived map

I noticed a case where the compiler semantics doesn't match the interpreter semantics:

CoreASM DerivedTest

use Standard

init Start

derived mySqrt(x) = x * x

derived myMap = {
        0 -> "Null",
        1 -> "One",
        2 -> "Two",
        3 -> "Three"
}

rule Start = {
        print "mySqrt(3): " + mySqrt(3)
        //print "myMap()(3): " + myMap()(3) // this line does not compile
        let x = myMap() in
                print "x(3): " + x(3) // prints undef when compiled
}

mySqrt is working fine (I just put it there to confirm that the Signature Plugin is working), but the map is inaccessible. It looks like x is stored on the localstack but read from the Storage. myMap()(3) does not compile with the error plugin KernelExtensionsPlugin is not compilable but mandatory.

Java calls with JASmine

Hi,
I hope you are still maintaining the coreASM project!
We are currently using a slightly modified version of coreASM in an EU-Project. However, when looking into the source code there is a plugin called JASmine which can be obviously used to execute Java calls.
Of course I could read through the whole implementation to understand the usage but would you have a tutorial or an example how to use it?
Many thanks in advance,
Eduard

argument leaked?

Hello, I have a problem with the following specification:

CoreASM TestTasks

use Standard

init Initialize

function task : NUMBER -> LIST
function taskChild : NUMBER -> NUMBER

function run : -> NUMBER

rule Initialize = {
    print("Initialize..")

    program(self) := @Run

    task(1) := ["AAAA", 10]
    task(2) := ["AAAA", 20]
    task(3) := ["BBBB", 30]

    taskChild(10) := 2
    taskChild(20) := 3

    run := 1
}

rule Run = {
    seq
        print("\n\n\n\nRun " + run + "\n")
    next
        DoTask(1)

    if (run > 2) then {
        program(self) := undef
    }
    else {
        run := run + 1
    }
}

rule DoTask(taskID) = {
    seq
        print("DoTask("+taskID+")..")
    next
        let x = task(taskID) in
        let action = nth(x, 1),
            n      = nth(x, 2) in {
            case action of
                "AAAA" : AAAA(taskID, n)
                "BBBB" : BBBB(taskID, n)
            endcase
        }
}

rule AAAA(taskID, n) = {
    seq
        print("AAAA("+taskID+","+n+")..")
    next
        let child = taskChild(n) in seqblock
            print("AAAA_PRE["+n+"] = " + taskID)
            AAAA_Inner("PRE["+n+"]", taskID)

            DoTask(child)

            print("AAAA_POST["+n+"] = " + taskID)
            AAAA_Inner("POST["+n+"]", taskID)
        endseqblock
}

rule AAAA_Inner(txt, taskID) = {
    print("AAAA_Inner["+txt+"] = " + taskID)
}

rule BBBB(taskID, n) = {
    print("BBBB("+taskID+","+n+")..")
}

Which produces the following output:

Initialize..




Run 1

DoTask(1)..
AAAA(1,10)..
AAAA_PRE[10] = 1
AAAA_Inner[PRE[10]] = 1
DoTask(2)..
AAAA(2,20)..
AAAA_PRE[20] = 2
AAAA_Inner[PRE[20]] = 2
DoTask(3)..
BBBB(3,30)..
AAAA_POST[20] = 2
AAAA_Inner[POST[20]] = 2
AAAA_POST[10] = 1
AAAA_Inner[POST[10]] = 1




Run 2

DoTask(1)..
AAAA(1,10)..
AAAA_PRE[10] = 1
AAAA_Inner[PRE[10]] = 1
DoTask(2)..
AAAA(2,20)..
AAAA_PRE[20] = 2
AAAA_Inner[PRE[20]] = 3
DoTask(3)..
BBBB(3,30)..
AAAA_POST[20] = 2
AAAA_Inner[POST[20]] = 3
AAAA_POST[10] = 1
AAAA_Inner[POST[10]] = 1




Run 3

DoTask(1)..
AAAA(1,10)..
AAAA_PRE[10] = 1
AAAA_Inner[PRE[10]] = 1
DoTask(2)..
AAAA(2,20)..
AAAA_PRE[20] = 2
AAAA_Inner[PRE[20]] = 3
DoTask(3)..
BBBB(3,30)..
AAAA_POST[20] = 2
AAAA_Inner[POST[20]] = 3
AAAA_POST[10] = 1
AAAA_Inner[POST[10]] = 1

I expected the output to be the same in all three runs, especially I didn't expect to see the output AAAA_Inner[PRE[20]] = 3 which looks like the "3" is leaked from the call of DoTask(3) in the first run.

developer's guide

add developer's guide to the github wiki. the guide mainly includes how to get the code, how to compile it, and how to run Carma or the Eclipse plugin.

find defined locations of function

Is it possible to find out the locations a function is defined at?

For example with this definitions:

function A : Agents -> NUMBER
function B : STRING -> NUMBER

I could do forall a in Agents with A(a) != undef do { ... }, however, how could I achieve this for B?

publish new version

Hi,

I want to create a new release of my own project. Can you publish a new version of CoreASM within the next few weeks? I don't want to have a SNAPSHOT dependency but need to include the fixes for #20 and #21.

By the way, the recent changes regarding performance (db0527e...e4efdf7, for reference) don't improve the performance much for my test files (at most 5%), but it seems you were concerned more about code quality and memory consumption which I didn't measure.

Collection functions are not accessing stacked values

With P seq Q the rule Q should behave like all updates from P were applied (Definition 4.1.1. on page 161 of the ASM Book).

Therefore I expect these two rules to have the same output:

rule Case1 =
    if myNumbers = undef then {
        myNumbers := {1, 2}
        numberData(1) := "one"
        numberData(2) := "two"
    }
    else
        // "data: {one, two}"
        print "data: " + map(myNumbers, @numberData)
rule Case2 =
    seq {
        myNumbers := {1, 2}
        numberData(1) := "one"
        numberData(2) := "two"
    }
    next
        // "data: {undef}"
        print "data: " + map(myNumbers, @numberData)

While the first case correctly prints "data: {one, two}" (in the second step) the second case prints "data: {undef}" (in the first step). More specifically I created test files for the map, filter and fold functions here: Locke@11b167e

I looked into the implementation a bit and it doesn't seem like a simple bug but more like a design problem of the map, filter and fold functions.

The interpreter correctly resolves both arguments myNumbers and @numberData through interpretExpressions -> frNode.getArguments -> getUnevaluatedNode. But then for example the method MapFunctionElement.getValue just calls getValue on the MapFunction of @numberData and not getValue on the storage - which should correctly load the value from the stack.

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.