Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • Jul 30 2022 14:17
    xiong-kun starred jbeard4/SCION
  • Jul 06 2022 06:21
  • Apr 14 2022 21:19
    fawaz-alesayi starred jbeard4/SCION
  • Jan 26 2022 05:17
    GitLab | Jacob Beard pushed 1 commits to scion
  • Jan 26 2022 05:17
    GitLab | Jacob Beard pushed 1 commits to scion
  • Jan 26 2022 05:15
    GitLab | Jacob Beard pushed 3 commits to scion
  • Jan 26 2022 05:06
    GitLab | Jacob Beard pushed 1 commits to scion
  • Dec 17 2021 21:09
  • Nov 07 2021 20:37
    agrrd starred jbeard4/SCION
  • Nov 02 2021 12:53
    jgshumate1 starred jbeard4/SCION
  • Sep 29 2021 20:56
    Abdallah Nasser commented on issue #4 eslint-plugin does not process .scxml files in visual studio code in scion
  • Sep 29 2021 17:09
    Christophe Gerard commented on issue #4 eslint-plugin does not process .scxml files in visual studio code in scion
  • Sep 29 2021 16:50
    Abdallah Nasser commented on issue #4 eslint-plugin does not process .scxml files in visual studio code in scion
  • Aug 02 2021 18:36
  • Jul 29 2021 04:22
    GitLab | Jacob Beard pushed 1 commits to scion
  • Jul 09 2021 21:55
    GitLab | Jacob Beard pushed 1 commits to scion
  • Jul 09 2021 21:55
    GitLab | Jacob Beard pushed 1 commits to scion
  • Jul 09 2021 21:52
    Jacob Beard merged merge request scion-scxml/scion!2 in scion
  • Jul 09 2021 21:52
    GitLab | Jacob Beard pushed to scion
  • Jul 09 2021 21:52
    GitLab | Jacob Beard pushed 3 commits to scion
Prashant Mumbarkar

For some reason ramp function in <transition> is not updating datamodel. Otherwise our solution works


const scxml = require("@scion-scxml/scxml");
const core = require("@scion-scxml/core");

let action = {
  "http://www.NotRealURL.de": {
    wait: function (action, builder) {
      const tic = new Date();
      while (true) {
        const toc = new Date();
        const duration = toc - tic;

        if (duration >= parseInt(action.duration.replace("ms", ""))) {
          console.log(duration + "here");

      return "something";

    expect: function (action, builder) {
      let expr = builder.generateFnCall(
        builder.generateAttributeExpression(action, "expr")
      return `if(${expr}){
            this.log('Expect Action Success');
        } else {
            this.log('Expect Action Failed');
    ramp: function (action, builder) {

        return `this.log(${action.dataid}.value); 
        for (let i =0 ; i < 10; i++) { 
          let temp=${action.dataid}.value + parseInt(${action.slope});
            ${action.dataid}.value = temp;
           // this.log(${action.dataid}.value);


  function (err, model) {
    if (err) throw err;
    model.prepare(function (err, fnModel) {
      if (err) throw err;
      //instantiate the interpreter
      var sc = new core.Statechart(fnModel);
      //start the interpreter

Input File below rampINPUT.scxml

<?xml version="1.0" encoding="UTF-8"?>
    xmlns:cs="http://commons.apache.org/scxml" version="1.0" initial="startup" datamodel="ecmascript" name="TestCase">
       <data id= "var1" expr="{'name':' var1','type':'Integer', 'value':2}"/>
        <data id= "var2" expr="{'name':' var2','type':'Integer', 'value':10}"/>
        <data id= "var3" expr="{'name':' var3','type':'Integer', 'value':5}"/>
       <data id="dummyVariable" expr="0"/>
    <state id="startup">
            <assign location="dummyVariable" expr="10"/>
            <assign location="dummyVariable" expr="20"/>           
            <ccdl:ramp id="ramp1" dataid="var1" slope="4"/>
            <assign location="dummyVariable" expr="30"/>           
            <assign location="dummyVariable" expr="40"/>
        <transition target="logic" >
            <assign location="dummyVariable" expr="605"/>
            <ccdl:ramp id="ramp2" dataid="var2" slope="400"/>
            <assign location="dummyVariable" expr="750"/> 
            <log label="dummyVariable here" expr="dummyVariable"/> 

        <transition event="TestCase.error" target="teardown" />
            <assign location="dummyVariable" expr="60"/>
            <ccdl:ramp id="ramp3" dataid="var3" slope="8"/>
            <assign location="dummyVariable" expr="70"/>  

            <log label="var1" expr="var1.value"/>       
            <log label="var2" expr="var2.value"/>              
            <log label="var3" expr="var3.value"/>  
            <log label="dummyVariable last" expr="dummyVariable"/>     
    <parallel id="logic">
        <state id="logic_c0" />
        <state id="logic_c1" />
        <transition target="teardown" />

    <state id="teardown">
        <transition target="final" />
    <final id="final" />

console output

var1 42
var2 10
var3 85
dummyVariable last 70
dummyVariable here 750
P.S : I deleted old messages as those problems were resolved and to declutter the space :)
Jacob Beard
@Mumbasms Sorry, I just saw your messages. I will review and follow up with you shortly
Jacob Beard
Reading through this, it looks like the datamodel should be getting updated
there is something strange about the console output. It looks like dummyVariable here shoudl occur after dummyVariable last
I would need to step through this in a debugger to investigate
Thanks for opening scion-scxml/scion#25. This looks like a bug in registerCustomActionTags and I will plan to fix this soon
it sounds like you have a workaround right now to that issue
Prashant Mumbarkar

@jbeard4 Oh understand. So far everything worked out.

1) "dummyVariable last" in <onexit> and "dummyVariable here" inside <transition> so as per SCXML rule, if I am not wrong,
while transitioning out from the state , sequence of execution : <onexit> of source state, <transition> executatable content
and then <onentry> of target state..

2) We wanted to use the ramp in parallel to the main execution i.e. in a separate thread.But it was pointed out to me that javascript is a single thread framework. Hence I decided to use uscxml- SCXML interpreter and transformer/compiler written in C/C++,
just to compare input and output files in the ramp. All credit goes to Korel for this :)

Prashant Mumbarkar
@jbeard4 I have a question. Have you ever used XSLT to transform SCXML into XML/SCXML or something similar? In my thesis, I used Apache SCXML to transform input to output, needless to say, the transformation logic is "hardcoded" in java. I was wondering if the same transformation is possible via XSLT or not ..
Jacob Beard

@Mumbasms Yes, in 2010 I developed an early version of SCION (then called scxml-js) as a project for the Apache Software Foundation as a part of Google Summer of Code, and this was implemented as an XSLT pipeline, such that it transformed SCXML to Javascript. I wrote a paper about it, which you can read here:


Slides are here:


Here is the source code:


Hope this helps.

I feel like there were some pretty good ideas in that project. It would be neat to extend it to support multiple language compilation targets, like Ragel:


Prashant Mumbarkar
@jbeard4 Thanks for the reply. I will look into it :)
Jacob Beard
Sounds good. It’s been more than 10 years since I’ve looked at that code, but let me know if you have any questions and I will try to answer them
Abdallah Nasser
Hello everyone, is there any way to enable scxml linting in vscode?
I've tried following jacob's tutorial on youtube, but it does not seem to be working. May be there is something missing
thanks in advance
Jacob Beard
Hi @AbdallahNasser , the eslint plugin needs maintenance - it needs to be updated to support the latest eslint version, and I have not had time to do this
Contributions are welcome here - I could provide some instructions on how to get started with this if you are interested in picking this up
As an alternative, you could use the following vscode plugin: https://marketplace.visualstudio.com/items?itemName=redhat.vscode-xml
Jacob Beard
This supports XSD validation, so it will automatically validate your SCXML and provide tag auto-completion in the editor.
You need to modify your SCXML a bit for this to work, basically adding the following lines to your <scxml> tag:
the downside to this approach is that it does not lint your inline javascript (e.g. <script>, @expr, etc), or validate referenced javascript variables against variables declared in your <datamodel>
but it will lint your xml, so it is better than nothing.
Abdallah Nasser
Thanks Jacob for your fast reply. For the time being I will try using what you just sent. BTW, I'm interested to be provided with your instruction and see if I can contribute
Jacob Beard
OK, I will follow up with you on this tonight
Jacob Beard

Hi @AbdallahNasser, here is a rough outline of the approach I would recommend taking to bring the @scion-scxml/eslint-plugin up-to-date. @scion-scxml/eslint-plugin is based on eslint-plugin-html:


@scion-scxml/eslint-plugin should be brought up to date with the changes in the latest eslint-plugin-html version. I would recommend diffing eslint-plugin-html version v4.0.6 to latest tagged release v6.2.0, then applying the relevant changes to @scion-scxml/eslint-plugin. Then the @scion-scxml/eslint-plugin can be tested locally with eslint. I would recommend using the command line version of eslint, rather than trying to use vscode integration for this.

I looked at this some time ago, and this seemed like a good approach, but did not have time to finish it. Let me know if you have any questions and I will attempt to help answer them.

Axel Terfloth
Hello together, i'm new to SCION. After reading the documentation and tutorials i wonder if there is a way to access elements of the datamodel from the client js code. Is this possible (and intended) or is the datamodel strictly encapsulated and direct access not possible?
Jacob Beard
Direct access is not possible
The datamodel is designed to be encapsulated
The way to access it is through getSnapshot, which gives you a copy
The way to mutate it is to send events into the machine, then mutate the data model when processing the event
Axel Terfloth
@jbeard4 thank you very much for the quick answer!
Jacob Beard
no problem, please feel free to reach me with any further questions