forester icon indicating copy to clipboard operation
forester copied to clipboard

Allow operations in arguments

Open besok opened this issue 2 years ago • 0 comments

Provide the operations with arguments "on the fly":

impl act(a:num, b:bool);
root main sequence {
   act(a = a + 1, b = b1 || b2 && !b3)
}

Arithmetic

Rules:

  • only numerical types or the node gets failed
  • different types get cast to the next type (int -> float) but binary and hex don't
  • when it is impossible the node gets failed
  • for division can be an exception also with 0
  • parentheses

Operations:

  • addition (+)
  • obstruction (-)
  • multiplication (*)
  • division (/)
  • the remainder (%)

Logical

Rules:

  • only boolean types or the node gets failed

Operations:

  • logical and (&&)
  • logical or (||)
  • logical not (!)
  • parentheses

Comparison

Rules:

  • the type should be the same
  • the gr,ls etc only for numeric types
  • parentheses

Operations:

  • Equal (==)
  • Greater (>)
  • Greater or Equal (>=)
  • Less(<)
  • Less or Eq (<=)
  • not Equal (!=)

besok avatar Oct 10 '23 23:10 besok