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

@tearflake/symbolverse

v0.2.12

Published

Symbolic term rewriting system

Downloads

100

Readme

// work in progress //

symbolverse v0.2.12

tags: s-expression, rewriting, term-rewriting, term-graph-rewriting

project roadmap:

  • [x] v0.1.x basic rewrite rules
  • [x] v0.2.x scoped rewrite rules
  • [ ] v1.0.x finalizing the package

project specifics

A term rewriting system is a tool for automating the transformation of expressions, enabling efficient problem-solving in areas like formal verification, symbolic computation, and programming. By applying systematic rules, it ensures consistent and correct results in optimizing code, proving theorems, and simplifying complex expressions.

An S-expression (Symbolic Expression) is a simple and uniform way of representing nested data or code using parentheses to denote lists and atoms, commonly used in Lisp programming and symbolic computation.

Symbolverse is a term rewriting system. Symbolverse code functions like a set of mathematical formulas, but with a broader scope. It can transform not just mathematical expressions but any type of S-expressions, depending on rules we provide. Symbolverse is a Turing complete system, which means it has the capability to perform any computation that can be done by any other known computational system.

To get a glimpse on how a Symbolverse program looks like, here's a simple example:

(
    REWRITE
    
    /expression addition/
    (
        RULE
        (VAR A B)
        (READ  (EXP (\add                \A \A)))
        (WRITE (EXP (\mul (((\0 \0) \1) \0) \A)))
    )
    
    /reducible fraction/
    (
        RULE
        (VAR A B)
        (READ  (EXP (\div (\mul \A \B) \A)))
        (WRITE (EXP \B                    ))
    )
)

Providing the input (div (add x x) (((0 0) 1) 0)), the example outputs x.

There are a couple resources about Symbolverse to check out:

building executables from source code

Symbolverse functions as a standalone executable operating on files. To build the executables from source code, do the following:

  1. make sure you have git, Node.js, and npm installed in your system
  2. enter OS command prompt
  3. install pkg: sudo npm install -g pkg on Linux, or npm install -g pkg on Windows
  4. change to your project directory
  5. clone this repository: git clone https://github.com/tearflake/symbolverse
  6. change directory: cd symbolverse
  7. run pkg: pkg . --out-path bin/
  8. if everything goes well, executables for Linux, Windows, and MacOS will be in ./bin/ directory

Executables run from command prompt, and take three parameters: rules-file, input-file, and output-file. If we omit the output-file parameter, the output is redirected to the terminal.

javascript API access

Symbolverse may expose its functionality through javascript API, both in browser and in Node.js.

To access the API from Node.js, install this package: npm i @tearflake/symbolverse, and include the following line in your code:

const Rewriter = require('@tearflake/symbolverse');

To access the API from browser, clone this repository from GitHub: git clone https://github.com/tearflake/symbolverse, and include the following line in your code:

<script src="path-to-symbolverse-package/symbolverse.js"></script>

Below, regardless of using Node.js or browser, use the API as:

var strRules = `
    (
        REWRITE
        (
            RULE 
            (READ  (EXP (\\hello \\machine)))
            (WRITE (EXP (\\hello \\world)  ))
        )
    )
`;

var arrRules = Rewriter.compile (strRules);

if (!arrRules.err) {
    var strInput = `
        (hello machine)
    `;

    var strOutput = Rewriter.rewrite (arrRules, strInput);

    if (!strOutput.err) {
        console.log (strOutput);
    }
}

further work

We are making efforts to reach the version 1.0.0.


// work in progress //