npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sorry-marvin

v1.0.0-0

Published

Sorry, Marvin! is an esoteric programming language that went wrong.

Downloads

2

Readme

Sorry, Marvin!

Sorry, Marvin! is a failed attempt to design a programming language to simulate Minsky register machines in the simplest way possible.

While the instruction set of Minsky machines, consisting of only two instructions INC and JZDEC, is already minimal, the instructions themselves are relatively complex, as they require one and two arguments, respectively.

Additionally, the registers and instructions in a Minsky machine must be labeled, which requires the use of numbers or other similarly powerful enumeration methods.

Sorry, Marvin! simplifies this by using two instructions together with only two symbols ! and >. No other symbols are allowed.

For this language produces code that is terrible to read and write, an apology is also necessary:

Doctor Minsky, please forgive me
for ruining machines near divine!
Now, full of quirks, they hum in circles
— miserably failed to shine.

Memory model

Sorry, Marvin! operates on four registers that hold unbounded unsigned integers, all initially set to zero.

A program starts with the first register as the current default.

Instructions

Sorry, Marvin! features two compound instructions, MVINC and DECJZDEC, move and increment and decrement; jump if zero, decrement otherwise:

| Instruction | Code | Meaning | | ----------- | ---------- | ------- | | MVINC | ! | Move to the next register and increment its value | | DECJZDEC | >×n | Decrement; if n > 1 then if the current register is zero, jump n instructions forward, decrement otherwise |

A program in Sorry, Marvin! is a cyclic, ordered list of instructions. When n of DECJZDEC exceeds the program length, the program counter wraps around to the beginning and jumps forward by the remainder of the division by n. Using this feature, backward jumps can be simulated via DECJZDEC.

The registers are also indexed in a cyclic list, meaning that performing MVINC with the (last) fourth register as the cursor will move back to the first register.

Examples

(Newlines are added arbitrarily.)

Addition

Adds the value of the second register to the first register:

!>!>!>!>!>>>>>>>>>>>>!>!>!!>!>!>>>>>>>>>!>

Fibonacci sequence

!>!>!>!>!>>>>>>!!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>!>!>!>!>!>!>!>!
>>>>>>>>>>>>>!!>!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>!>!>!>!>!>!>>>>>>>>>!>
!!!>!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>!>>>>>>

Hello World

For computing "Hello World" the numbers in the registers must be interpreted as letters. It can achieved by defining a simple alphabet:

| Letter | Value | | :----: | :---: | | | 1 | | d | 2 | | e | 3 | | H | 4 | | l | 5 | | o | 6 | | r | 7 | | W | 8 |

The following program sets the first register progressively to 4, 3, 5, 5, 6, 1, 8, 6, 7, 5, 2 which corresponds to "Hello World":

!>!>!>!!>!>!>!!>!>!>!!>!>!>!!>!>!>!>>>>>>>!>!>!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>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>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>!>!>!>!!>!
>!>!!>!>!>!>>>>>>>!>!>!>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>!>

Simulating a Minsky machine

Simulating INC and JZDEC using MVINC and DECJZDEC is relatively straightforward.

INC

To increment a register n (where n=0..3), we first need to move to the preceding register. This can be accomplished by using the nondestructive subroutine !> repeated (4+n-1-c)%4 times, where c is the current register index:

Example: Increment the third register (n=2):

!>!>!

JZDEC

To counteract the initial decrement in DECJZDEC, an additional increment must be performed beforehand. Once again, the subroutine !> can be used to navigate between registers:

Example: Set the second register to 1 if the first register is not 0:

!>!>!>!>>!!>

JavaScript interpreter

npm i sorry-marvin
const sorry = require('sorry-marvin')

// [40, 0, 0, 0]
sorry(`>!>!>!>!>>`, [42, 0, 0, 0])

License

MIT