Onesharp

From Esolang
Jump to navigation Jump to search

Onesharp (or 1#) is a minimalistic programming language created as a teaching tool by Larry Moss.[1] It operates on a register machine model, in which instructions can modify registers or control program flow. The language features five fundamental operations: appending 1 or # to a register, jumping forward or backward by a specified number of instructions, and a conditional branching mechanism that removes and examines the first character in a register. Onesharp programs consist entirely of sequences of 1's and #'s.

Syntax

Onesharp (1#) Instruction Set
Instruction Meaning
1ⁿ# Append 1 to register n.
1ⁿ## Append # to register n.
1ⁿ### Move forward n instructions.
1ⁿ#### Move backward n instructions.
1ⁿ##### Conditional branching on register n:
  • If empty, move to the next instruction.
  • If the first character is 1, delete it and move forward two lines.
  • If the first character is #, delete it and move forward three lines.

Purpose

Onesharp is introduced through an interactive Jupyter notebook tutorial, which includes an interpreter and step-by-step execution tools written in Python. Users are guided through small programs and exercises demonstrating basic operations. The notebook also provides command-line tools for parsing and running onesharp programs. Moss then uses onesharp to define computability and demonstrate several fundamental results of computability theory.

References

  1. Moss, Lawrence S. "Invitation to Computability." lmoss.github.io.