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

@everseen/square

v0.1.2

Published

square language — a Lisp-like bytecode VM compiled to wasm, with an async runtime driven by the host event loop

Downloads

56

Readme

square

A toy Lisp-style language written in Rust, supports first-class function and continuation, aims to be both fun and expressive.

Playground

Q & A

  1. What's this?

    Square is a neat Lisp-inspired language, crafted with Rust. It's all about simplicity and cleanliness, aiming to reduce the reliance on control keys like <Ctrl> and <Shift>. That's why it only uses symbols like ., [], ;, and / to structure the code.

    Square is parsed by a recursive descent algorithm, compiled to a custom (high level) instruction set, and operates on a stack-based virtual machine.

  2. Why called square?

    Square use [] rather than () which is adopted in most Scheme dialects, giving it a truly "square" shape that matches its name.

Variable

; basic
[let x 2] ; x = 2

; expansion
[let [x y] [vec 1 2]] ; x = 1, y = 2

; convenient placeholders in expansion
[let [. x] [vec 1 2 3]] ; x = 2, `.` is a placeholder that MUST occupy one position
[let [... x] [1 2 3 4]] ; x = 4, `...` is a placeholder that can occupy zero or as many positions as possible
[let [. [x] ... y] [vec 1 [vec 2] 3 4 5]] ; x = 2, y = 5

Control flow

; match
[cond
  [[> -2.3e-2 x] foo]
  [[[regex '[a-z]+' 'gi'].test x] bar]]

; branch
[if true true]
[if true true false]

; block
[begin 
  [let i 0]
  [while [< i 10]
    [print i]
    [+= i 1]]]

Function(first class)

; function starts with /[ as it looks like λ
[let foo /[] 2]

[foo]

; expansion in parameter
[let foo /[[.] z] [print z]]

[foo [vec 'ignored'] 0]

[let fib /[n] 
  [if [<= n 2] 
    1
    [+ [fib [- n 1]] [fib [- n 2]]]]]

[println [fib 30]]

Continuation(first class)

[let gen /[yield]
                [begin 
                    [let i 0]
                    [while [< i 4]
                        [callcc /[cc] [yield [vec i cc]]]
                        [+= i 1]]]]
[let iter_k nil]
[let next /[g]
            [begin 
                [if iter_k
                    [iter_k]
                    [begin
                        [let value [callcc /[cc] [g cc]]]
                        [if [== [typeof value] 'vec']
                          [begin 
                            [let i nil]
                            [= [i iter_k] value]
                            [println i]]
                          nil]]]]]

[next gen]
[next gen]
[next gen]
[next gen]
[next gen]
[next gen]

Structure

You can customize the behavior of getters and setters by using proxy syscall, unlocking the ability to implement features such as proxies and inheritance.

[let o [obj]]

[let observer println]

[let p [proxy o 'set' /[t k v] [begin
  [if observer [observer k v]]
  [set t k v]]]]

[= p.x 42]  ; print x 42
[print o.x] ; 42

Async

; sync await, based on setTimeout
[sleep 1000]

; defer execution, based on queueMicrotask
[defer /[] [println 42]]

; schedule
[spawn /[] [begin [sleep 400] [println 'A done']]]
[spawn /[] [begin [sleep 600] [println 'B done']]]

Comment

; comment
; inline ;

BNF

hex -> [0-9a-fA-F]
ascii_escape -> x hex hex
unicode_escape -> u hex{4}
single_escape -> ['\\bfnrtv]

escape -> \\ ascii_escape | unicode_escape | single_escape

str -> ' ([^'\\\r\n] | escape )* '
num -> -?[0-9]+(\.[0-9]+)?(e|E-?[0-9]+)?

expand -> [ (. | ... | id | expand)+ ]
fn -> / expand expr

prop ->  . id
assign -> let (expand | id) expr | = (expand | id prop*) expr

op -> (operator expr expr*) | (assign_operator id prop* expr*)

call -> [ assign | op | expr* ]

dot -> (str | id | call) prop*

expr -> fn | -?(num | dot)