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

trac64i

v1.0.2

Published

TRAC-64 text-processing language interpreter (Etudes for Programmers, Ch. 7)

Readme

TRAC interpreter (trac64i)

A TRAC-64 interpreter — the text-processing language invented by Calvin Mooers in 1964 and presented as an etude by Charles Wetherell in Etudes for Programmers (1978).

Every TRAC program is a macro expansion over a shared string: function calls are written #(name,arg1,arg2,…), the innermost call is evaluated first, its result is substituted back into the containing string, and the scanner re-reads from that point. Two call modes: #(…) rescans the result (active), ##(…) appends it literally (neutral).

The interpreter is written in TypeScript. It implements the full TRAC-64 primitive set from the book plus two extensions suggested there: forms can be called directly by name (#(myform,x)#(cl,myform,x)), and user-defined forms can shadow builtins.

Not implemented: external stream I/O (ai, ao, sp, rp) and external block storage (sb, fb, eb). These return "N/A".

All functions are covered by unit tests.

Install

Globally, as a CLI:

npm install -g trac64i

trac64i path/to/program.trac
trac64i "@#(ps,hello)'"
trac64i                    # interactive REPL

Or run directly from a checkout of this repository — node (24+), bun, or deno can all execute trac.ts without a build step.

Examples

The commands below are run from a checkout of the repository; substitute trac64i for node trac.ts if you installed the CLI globally.

"e" constant

node trac.ts examples/e.trac

2.7182818277

"pi" constant

node trac.ts examples/pi.trac

3.1415926538

factorial

node trac.ts examples/factorial.trac

30414093201713378043612608166064768844377641568960512000000000000

Hanoi puzzle solver

node trac.ts examples/hanoi.trac

from 1 to 3
from 1 to 2
from 3 to 2
from 1 to 3
from 2 to 1
from 2 to 3
from 1 to 3

Rule 110 automaton

node trac.ts examples/rule_110.trac

...............1...............
..............11...............
.............111...............
............11.1...............
...........11111...............
..........11...1...............
.........111..11...............
........11.1.111...............
.......1111111.1...............
......11.....111...............
.....111....11.1...............

Run code directly

Command-line arguments prefixed with @ are treated as inline TRAC programs instead of file paths:

node trac.ts "@#(ps,I am TRAC)'"

I am TRAC

Interactive mode

node trac.ts

TRAC interpreter (CTRL-C or #(hl)' to exit)

TRAC>

Language reference

Implemented primitives, grouped:

  • Formsds (define), ss (segment with markers), cl (call), ln (list names), da (delete all), dd (delete).
  • Form pointer / segmentationcs (call segment), cc (call character), cn (call N chars), in (call-in / find), cr (call restore, and radix change when arity is 3), pf (print form), sr (segment-rank).
  • Arithmetic (bigint)ad, su, ml, dv.
  • Boolean (bit strings)bu (union), bi (intersection), bc (complement), bs (shift), br (rotate).
  • Comparisoneq, gr.
  • I/Ops (print string), rs (read string), rc (read character).
  • Character / metacd (char→decimal codepoint), dc (decimal→char), sl (string length), cm (change meta), qm (query meta).
  • Tracingtn (trace on), tf (trace off), hl (halt).

See info/trac.pdf for Wetherell's etude description and info/cowan/ for supplementary material.

Development

bun install

just test         # run the test suite (81 cases)
just build        # tsc -> dist/
just publish      # patch version + npm publish (maintainer only)

License

MIT — see LICENSE.