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 🙏

© 2026 – Pkg Stats / Ryan Hefner

plang-interpreter

v0.0.2

Published

A Deviation Language Interpreter

Readme

The Deviation Interpreter

or Devia for shorten.

Description

This repository houses the source code of the deviation interpreter written entirely in Typescript.

The source code are all in the src/ folder. compiler/ contains the lexer and parser; inout/ contains the input and output functions; linking/ contains the linker; problem/ contains the error printer; repl/ contains the REPL; vm/ contains the virtual machine emitter and stack machine; extensions/ are code that I've copied from stackoverflow.

Examples

# this is a comment
# fibonacci calculator
func fib(n) {
    if n < 2 {
        return n
    }
    return fib(n - 1) + fib(n - 2)
}
# print the 12th fibonacci number
say(fib(12))
# program that asks for your name forever
loop {
    name = ask("What is your name? ")
    if name == null {
        break
    }
    say("Hello", name)
}
# type functions
impl times(self, function) for Num {
    loop self { # loop self amount of times
        function()
    }
}

func sayHello() {
    say("Hello")
}

# print Hello 3 times
3.times(sayHello)

# or alternatively
3.times(func() {
    say("Hello")
})
# closures are supported
func makeCounter(initial) {
    @count = initial # the @ shows that we are creating a variable, not assigning to an existing one
    return func() {
        @old = count
        count = count + 1
        return old
    }
}

counter = makeCounter(1)
say(counter()) # prints 1
say(counter()) # prints 2
say(counter()) # prints 3
# who needs classes anyways
func makeVector(x, y) {
    @data = list(x, y)
    return dict(
        get: func() {
            return data
        },
        set: func(newX, newY) {
            data = list(newX, newY)
            return data
        }
    )
}

v1 = makeVector(1, 2)
say(v1.get()) # prints list(1, 2)
v1.set(2, 3)
say(v1.get()) # prints list(2, 3)
# using javascript inside of devia
values = list(1, 10, 20, 30)

javascript """
    const values = pl.import("values"); // import the variable "values" from devia
    function factorial(n) {
        if (n < 2) {
            return 1;
        }
        return n * factorial(n-1);
    }
    const out = [];
    for (const value of values) {
        out.push(factorial(value));
    }
    pl.export("out", out); // export the variable as "out" to devia
"""

each item, index of out {
    say("factorial", values.get(index), "=", item)
}

How do I use it

If you have the executable, devia.exe <file> will run the file. You can also start the REPL by running devia.exe directly with no arguments.

If there is no executable, see the section below to build it yourself.

How do I build it

Node 12 or higher is used to build the interpreter, but feel free to try it with a lower node version. The command node -v will tell you if node is installed on your machine.

Run npm install first to install all the dependencies, and run npm run build-cli to make an executable in the dist/ folder. Rename the executable for your platform to devia.exe.

Other commands located in package.json are as follows

npm run build         ;; compiles typescript into javascript
npm run run           ;; runs the compiled javascript using node
npm run clean         ;; cleans the compiled javascript folder
npm run build-run     ;; clean, compile typescript then runs it
npm run build-browser ;; produce a AMD format single file index.js for use in a browser