(* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. *) open Utils type register = | X | T | F | M and r_n = | R of register | N of int and op_code = | NOOP | COPY of r_n * register (* Math *) | ADDI of r_n * r_n * register | SUBI of r_n * r_n * register | MULI of r_n * r_n * register | DIVI of r_n * r_n * register | MODI of r_n * r_n * register | SWIZ of r_n * r_n * register (* Branching *) | MARK of string | JUMP of string | TJMP of string | FJMP of string (* Testing *) | TEST_EQ of r_n * r_n | TEST_LT of r_n * r_n | TEST_GT of r_n * r_n (* Lifecycle *) | REPL of string | HALT (* Movement *) | LINK of r_n | HOST of register (* Communication *) | MODE | VOID_M | TEST_MRD (* File Manipulation *) | MAKE | GRAB of r_n | FILE of register | SEEK of r_n | VOID_F | DROP | WIPE | TEST_EOF and mode = | LOCAL | GLOBAL and exa = { name : string; mutable dead : bool; mutable x : value; mutable t : value; mutable f : file option; mutable f_pos : int; (*mutable m : Value.t option;*) mutable mode : mode; code : op_code Dynarray.t; mutable ip : int; labels : int StringMap.t; mutable host : host; mutable waiting : bool; } and host = { name : string; grid_size : int; mutable grid : obj StringMap.t; mutable links : host IntMap.t; mutable send : exa Queue.t; mutable receive : exa Queue.t; } and value = | Int of int | Key of string and file = { name : string; mutable contents : value Dynarray.t; } and obj = | F_o of file | E_o of exa and syntax_error = { line_num : int; msg : string; exa : string option; } and code = { ops : op_code list; errors : syntax_error list; labels : int StringMap.t; }