
syntax = "proto3";
package xolir;
option java_package = "com.apivolve.xolir";

import "xolir/refs.proto";

message Expression {
  oneof expr {
    Read read = 10;
    Store store = 11;
    Call call = 12;
    If if_ = 13;
    While while_ = 14;
    Return return_ = 15;
    sint64 int = 20;
    double real = 21;
    string text = 22;
    bool bool = 23;
  }
}

message Read {
  uint32 var_ix = 1;
}

message Store {
  uint32 var_ix = 1;
  Expression value = 2;
}

message Call {
  FuncRef func = 2;
  repeated Expression arguments = 1;
}

message If {
  Expression condition = 1;
  repeated Expression code = 2;
  repeated Expression else = 3;
}

message While {
  Expression condition = 1;
  repeated Expression code = 2;
}

message Return {
  Expression value = 1;
}
