Skip to content

BF: interpreter EOF format is not specified #55

Open
@Voileexperiments

Description

@Voileexperiments

https://esolangs.org/wiki/Brainfuck#Implementation_issues

EOF is a controversial issue. Many implementations return 0, some return -1, and several notable brainfuck programmers suggest that on EOF the memory cell should be left as-is, without modification. In the original distribution the compiler left the cell unchanged, while the interpreter used the EOF from C which, strictly speaking, could be any negative integer, but which usually is -1 (which, in the case of byte-sized cells, ends up as 255).

The current interpreter used for the BF language version uses 0xFF as EOF, which poses a trap for both kata makers and kata solvers:

  • input needs to be zero-terminated manually in the input, or they really aren't terminated at all
  • we cannot assume that reading pass the end of the input will zero a cell, so we need to do [-] instead of , to zero a cell.

At least this should be documented somewhere.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions