lf-lang / lingua-franca

Intuitive concurrent programming in any language
https://www.lf-lang.org
Other
234 stars 62 forks source link

Modal model without cyclic dependencies is rejected because cyclic dependencies #2364

Open NiklasRentzCAU opened 2 months ago

NiklasRentzCAU commented 2 months ago

The following model is seen by LF to have cyclic dependencies, whereas the modes break that cycle and the model should be accepted instead.

target C

reactor R {
  input in: bool
  output out: bool

  reaction(in) -> out {=
    lf_set(out, 0.0f);
  =}

}

main reactor {
  r = new R()

  initial mode A {

    reaction(r.out) {==}
  }

  mode B {
    reaction(startup) -> r.in {=
      lf_set(r.in, true)
    =}
  }

}

cyclic-modes

Both modes are unconnected and it can never be the case that the reaction in mode A happens in the same tick before the reaction in mode B.