Relative TOGA/Interpreters

From Esolang
Jump to navigation Jump to search

C++ implementation

#include <iostream>
#include <array>
#include <stdint.h>

// Define the instruction
#define F(a,b) p += a; A[p] ^= true; if (A[p]) {goto b;}

int main()
{
    std::array<bool,65536> A;
    A.fill(false);
    uint16_t p;
    
    // Write code here, or Look at the example
    F(-1,l0)
    l0:
    F(0,l1)
    l1:
    F(0,l1)
}