Fleet  0.0.9
Inference in the LOT
Instruction.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <assert.h>
4 #include <iostream>
5 #include <variant>
6 
7 #include "VMSRuntimeError.h"
8 #include "Ops.h"
9 #include "VMStatus.h"
10 
20 struct Instruction {
21 public:
22 
23  // the function type we use takes a virtual machine state and returns a status
24  void* f;
25  int arg;
26 
27  // constructors to make this a little easier to deal with
28  Instruction(void* _f=nullptr, int a=0x0) : f(_f), arg(a) {
29  assert(f != nullptr); // we just can't even store null f, and we'll get an error on construction.
30  }
31 };
32 
39 std::ostream& operator<<(std::ostream& stream, Instruction& i) {
46  stream << "[INSTR " << i.f << "]";
47  return stream;
48 }
void * f
Definition: Instruction.h:24
int arg
Definition: Instruction.h:25
Definition: Instruction.h:20
Instruction(void *_f=nullptr, int a=0x0)
Definition: Instruction.h:28
std::ostream & operator<<(std::ostream &stream, Instruction &i)
Output for instructions.
Definition: Instruction.h:39