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

@sunruse/influx

v0.0.2

Published

A simple programming language offering basic functional programming and vector mathematics which compile to JavaScript and GLSL.

Downloads

3

Readme

SUNRUSE.influx

A simple programming language offering basic functional programming and vector mathematics which compile to JavaScript and GLSL.

This README describes how to use the NPM package. A tutorial will be provided when the language is further finalized.

Basic usage:

The "Compile" function runs the toolchain, currently returning the generated source code string, or undefined if it could not be compiled.

This will change in the near future to return more information.

var influx = require("@sunruse/influx")
console.log(influx.Compile("1 + 3, 4", influx.GLSLCSyntax))
console.log(influx.Compile("1 + 3, 4", influx.JavaScriptCSyntax))
ivec2((1 + 3), 4)
[(1 + 3), 4]

Toolchain

This is the sequence of function calls made by the "Compile" function shown above.

This will change in the near future.

ParseUntypedTokens (string -> UntypedToken[])

Splits down the input file by whitespace into token objects, but does not attempt to identify them.

ParseTokens (UntypedToken -> UnparenthesizedToken[])

Identifies a given token object. May split said token into further tokens ("324+95" becomes "324", "+", "95", for example).

ParenthesizeTokens (UnparenthesizedToken[] -> ParenthesizedToken[])

Finds matching pairs of parentheses and converts the flat array of tokens into a tree of parentheses.

ParseExpression (ParenthesizedToken[], integer, integer -> RawExpression)

Parses given tokens (with a start and end index into the file) into a basic expression AST.

InlineExpression (RawExpression, Scope -> InlinedExpression)

Inlines all variable declarations, references and function calls.

Scope is an object, where the keys are lowercase variable names, and the values are InlinedExpressions they refer to.

UnrollExpression (InlinedExpression -> UnrolledExpression[])

Unrolls all vector mathematics into scalar operations. Each item in the returned array represents a dimension of the resulting vector ("3, 4, 5" would create 3 UnrolledExpressions, for example).

TypecheckExpression (UnrolledExpression -> TypecheckedExpression)

For unary and binary operators, finds which specific typed version ("integer add" or "float add" as opposed to just "add", for instance) applies in each case.

VerifyExpression (TypecheckedExpression -> VerifiedExpression or undefined)

Up until this point, any errors encountered were included as part of the expression tree. This is so they can be shown even if they are not part of the critical path, with reasonable traceability.

This function walks the critical path, creating a simplified AST, or returning undefined should an error exist in the critical path.

MatchCSyntax (VerifiedExpression[], CSyntax -> CSyntaxMatch or undefined)

Matches up the verified expression to the operations available on the target platform. This may fail and return undefined if operations are not implemented or impossible on the target platform.

GenerateCSyntax (CSyntaxMatch, CSyntax -> string)

Generates the final source code from the matched C Syntax.