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

cppc

v1.0.0

Published

:..: (colon period period colon) esoteric programming language

Downloads

12

Readme

:..:

:..: (colon period period colon) is an esoteric programming language based on the manipulation of four unbounded integer registers.

Language

Syntax

A program in :..:

  1. Consists only of the symbols : (colon) and . (period); all other symbols are ignored.
  2. Is a sequence of 4-tuples that form program instructions (the program length % 4 == 0).
  3. Has a length greater than zero (at least one 4-tuple).

Semantics

Registers

Each 4-tuple reads or manipulates one of the four registers A, B, C, D.

The current register is determined by the index of the instruction in the program code. For instance, the first instruction works with A, fourth with D, fifth with A, and so on.

Instructions

Four possible instructions can be formed based on the position of the colon in a 4-tuple:

| Instruction | Name | Meaning | Code | | :---------: | ---- | ------- | ---- | | | Noop | Do nothing | .... | | + | Increment | Increments the current register value | .:.. | | - | Decrement | Decrements the current register value | ..:. | | [ | Loop begin | Jumps to the loop end if the current register value is not zero | :... | | ] | Loop end | Jumps to the paring [ | ...: |

Instructions [ and ] are paired, meaning each [ must have a following ] and vice versa.

Instructions can be combined into compact ones. For instance, the 4-tuple ::.. contains both instructions [ (loop begin) and + (increment). Compact instructions are executed in the order they appear in the 4-tuple.

Examples

No-op program

Does nothing:

....

Infinite loop

Loops forever:

:..:

Alternativelly:

::::

Clear

Sets register A to zero:

.... .... :... ....
:... .... .:.. ....
.:.: .... .... ....
..:: .... ..:. .... 

The program reads as follows:

C[ A[ C+ A+] A-] C-

Move

Moves register B to register A:

.... .... :... ....
.... :... .:.. ....
.... .:.: .... ....
.:.. ..:. ...: ....
..:. ..:. ..:. ....

The program reads as follows:

C[ B[ C+ B+] A+ B- C] A- B- C-

Copy

Copies register A to register B:

.... .... :... ....
:... .... .:.. ....
.:.: .... .... ....
..:. .:.. .... .:.:
.... ..:. ..:. ..:.
.... .... :... :...
.... .... .:.. .:.:
.... .... .... ..:.
.:.: .... .... ....
..:. .... ..:. ....

The program reads as follows:

C[ A[ C+ A+] A- B+ D+] B- C- D- 
C[ D[ C+ D+] D- A+] A- C-

Switch

Switches register A with register B:

.... .... :... ....
::.. .... .:.: .:..
..:: .... ..:. ..:.
.... .... :... ....
.... ::.. .:.: ....
.:.. ..:: ..:. ....
..:. .... :... ::..
.... .... .:.: ..:.
.... .:.: ..:. ....
.... ..:. .... ....

The program reads as follows:

C[ A[ A+ C+] D+ A-] C- D-   move A to D
C[ B[ B+ C+] A+ B-] C- A-   move B to A
C[ D[ D+ C+] D- B+] C- B-   move D to B

Fibonacci sequence

Computes the sequence in register A:

.... .:.. :... ....
.... .... :... ....
::.. .... .:.: .:..
..:: .... ..:. ..:.
.... .... :... ....
.... ::.. .:.: ....
.:.. ..:: ..:. ....
..:. .... :... ::..
.... .... .:.: ..:.
.... .:.: ..:. ....
.... ..:. :... ....
::.. .... .:.: .:..
..:. .:.: ..:. ..:.
.... ..:. :... ::..
.... .... .:.: ..:.
.:.: .... ..:. ....
..:: .... .... ....

The program reads as follows:

B+                              init 0 1 0 0
C[                              loop forever
    C[ A[ A+ C+] D+ A-] C- D-   move A to D
    C[ B[ B+ C+] A+ B-] C- A-   move B to A
    C[ D[ D+ C+] D- B+] C- B-   move D to B
    C[ A[ A+ C+] D+ A- B+] C- D- B- 
    C[ D[ D+ C+] D- A+] C- A-   copy A to B
]

Hello World

For computing "Hello World," we need to interpret integers in registers as a string. We can achieve this by defining an alphabet and concatenating register values.

| Symbol | Binary | | ------ | ------ | | | 000 | | d | 001 | | e | 010 | | H | 011 | | l | 100 | | o | 101 | | r | 110 | | W | 111 |

Registers must contain the following values:

| Register | Binary | Decimal | Interpreted | | -------- | --------- | ------- | ----------- | | A | 011010100 | 212 | Hel | | B | 100101000 | 296 | lo | | C | 111101110 | 494 | Wor | | D | 100001 | 33 | ld |

Shortened code:

.:.. .:.. .:.. .:..     33 times
.:.. .:.. .:.. ....    179 times
.... .:.. .:.. ....     84 times
.... .... .:.. ....    198 times

Turing completeness

:..: is intuitively Turing-complete as it provides four unbounded registers (two have been proven to be sufficient), elementary arithmetics, and while loops.

A concrete proof is still to be done.

JavaScript interpreter

npm i cppc
const cppc = require('cppc')

// [2, 0, 1, 1]
cppc(`.:...:...:...:...:....:.`)

License

MIT