I built my own interpreter for the esolang ><>. However, over time I've been notified of various ways my version differs from the official interpreter. Each time I patch things but it's annoying because sometimes that breaks existing code that uses my version.

These are all obscure edge cases related to things like Unicode characters or edges of the code box, floating point errors, etc. Things not specified in the specification but sometimes relied on for golfing.

I find it really hard to spot these differences because the situations they show up are so specific.

I'm seeking an effective method to find these differences so that I can patch them.

  • $\begingroup$ Not an answer, but if you're worried about the patches breaking existing code, you might want to maintain an unpatched version as your own personal fork. $\endgroup$ Commented Feb 2 at 19:50
  • 2
    $\begingroup$ Does the language have a specification? If so, translating the spec into a test suite is going to be a lot easier than translating the reference implementation into a test suite. If there is no specification, then the reference implementation may also have some behaviour which would be considered "implementation-defined" (e.g. a native unordered hashmap), so it's not necessarily objectively decidable whether any particular difference in behaviour really is a defect in your implementation. $\endgroup$
    – kaya3
    Commented Feb 5 at 18:25
  • 1
    $\begingroup$ @kaya3 A specification exists but it's incomplete. My implementation implements the specification exactly, the issues are related to areas where the specification is ambiguous or incomplete $\endgroup$
    – mousetail
    Commented Feb 6 at 9:58

2 Answers 2


Create a test suite for ><>

It seems like there are no standard test suite for ><>. It is always a good time to start making one. Every time you find behavior differences, add a test case.

Tests are very useful in general for ensuring correct behavior of an interpreter. But they also document what the behavior is (or was). They will let you keep track of each behavior difference.

These tests will also be useful to the entire community of ><> implementers.

Use random program generation

You could start by generating a syntax tree directly with random nodes. Then, you'd run all these programs on many interpreters and compare the results. This could find many more new test cases to add to the test suite.


First, ensure you have a good way to detect and diagnose differences between the interpreters. I think you could write a tester which runs both interpreters step-by-step and reports when they diverge. Otherwise (if the programs run steps differently or you can't run the official interpreter step-by-step) write a tester which checks behavior (e.g. log messages or system calls): record the base interpreter's behavior (ground truth), and and report the first step where your interpreter's behavior diverges from the recording.

Then as @Eldritch Conundrum stated, you want a test-suite and test-case generator. Besides random program generation, you can also try cloning and randomly modifying existing tests (this may be mutation testing but idk if that refers to something different, since these "mutants" aren't necessarily killed.)

Keep in mind that test quality matters more than test quantity, and 1,000 tests which all test the same thing are no more useful than 1. You'll need to ensure the test generator isn't creating gibberish which all gets evaluated very similarly, and you may need to look into the interpreters' sources to find edge cases and write tests covering those yourself.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .