tmteam / NFun

Expressions Evaluator for .NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Multi-expression runtime node

tmteam opened this issue · comments

Assume '<{ … }>' as multiline node (not in syntax, but for example of how it works under the hood)

for example:


a = let:
          d = b**2 -4a*c
          {       #value to return
                  x1 = ( -b + sqrt(d))/2a
                  x2 = (-b - sqrt(d)) /2a
          }
       end

# turns into

a = 
          <{
              d = b**2 -4a*c
              return {  #value to return
                  x1 = ( -b + sqrt(d))/2a
                  x2 = (-b - sqrt(d)) /2a
              }
          }>   
a = x<y<z

# turns into

a = 
    <{
        r1 = x<y
        return 
            if(not r1) false
            else  y<z
    >}

multi-expression node , semantically, can contains only assignment expressions and return statement at the end