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

xasm

v0.0.1

Published

Assembly inspired language, made for fun.

Downloads

5

Readme

xAsmLogo

🔧 A simple assembly-inspired programming language and interpreter implemented in JavaScript

xASM is a lightweight assembly-like language designed for learning and experimentation. It features a custom instruction set, register-based architecture, and a JavaScript interpreter that can execute xASM programs.

Features

  • Assembly style syntax: Familiar assembly-like instruction format with labels and jumps
  • Register based architecture: Uses registers A, B, C, D, E for operations and data storage
  • Basic arithmetic: Support for ADD, SUB, MUL, DIV, MOD, and POW operations
  • Control flow: Jump instructions (JMP, JEQ) with label support for loops and conditionals
  • String perations (USELESS RIGHT NOW!): CONCAT for string concatenation and LEN for length operations
  • System Calls: CALL instruction for output and system operations
  • Tiny and lightweight: Pure JavaScript implementation with no external dependencies

📦 Installation

git clone https://github.com/xbcq1490/xASM.git
cd xASM
npm install -g .

🚀 Running Programs

# Run the included example
npm test
# Run with the cli tool
xasm ./path/to/file.xa
# Or run manually
node cli.js ./path/to/file.xa

📖 Language Reference

Registers

xASM has ~~infinite~~ registers.

  • Used for storing values, performing calculations, and passing parameters

Instructions

Data loading

LOAD A, 42        ; Load immediate value 42 into register A

Arithmetic operations

ADD A, 5          ; Add 5 to register A
SUB A, 3          ; Subtract 3 from register A
MUL A, 2          ; Multiply register A by 2
DIV A, 4          ; Divide register A by 4
MOD A, 3          ; A = A modulo 3
POW A, 2          ; A = A raised to power of 2
UNM A, B          ; Unary minus operation

String operations (currently useless tbh)

CONCAT A, B, C    ; Concatenate all values, then store in A register
LEN A, B          ; Get length of value in B, store in A

Control Flow

LABEL loop        ; Define a label named 'loop'
JMP loop          ; Jump to label 'loop'
JEQ A, 0, end     ; Jump to 'end' if A equals 0
JEQ A, 5, true, false  ; Jump to 'true' if A equals 5, otherwise 'false'

System Operations

CALL C, A         ; System call, 0 = print, 1 = error
HALT              ; Stop program execution

Comments

; This is a comment - lines starting with semicolon are ignored

📋 Example Programs

Simple Counter

; Count from 1 to 10
LOAD A, 1
LOAD C, 0

LABEL loop
CALL C, A         ; Print current number
ADD A, 1          ; Increment counter
JEQ A, 11, end, loop  ; Continue if A < 11

LABEL end
HALT

🏗️ Architecture

The xASM interpreter consists of several components:

  • Parser (src/parser/): Parses xASM source code into a tree.
  • Interpreter (src/interpreter/): Executes the parsed instructions using a virtual machine
  • Opcodes (src/opcodes/): Defines the instruction set and argument requirements
  • Registers (src/registers/): Register template
  • Utils (src/utils/): Utilities

⚠️ Requirements & Limitations

  • Node.js: Requires Node.js 12.0 or higher
  • File Extension: Uses .xa extension for xASM source files
  • No Memory Model: Operations are register-based only
  • Limited I/O: Only supports basic print output via CALL instruction

🔧 Error Handling

The interpreter provides basic error handling for:

  • Invalid instruction syntax
  • Missing opcodes
  • Register access errors
try {
    const vm = new interpreter(parsed.tree);
    vm.executeTree();
} catch (error) {
    console.error("Execution failed:", error, message);
}

🤝 Contributing

Contributions are welcome! This project was made as an experiment. Feel free to:

  • Add new opcodes
  • Improve the parser
  • Enhance error handling
  • Create more example programs
  • Optimize the interpreter

Please feel free to submit a Pull Request.

📝 License

This project is licensed under the GPL-3.0-or-later License - see the LICENSE file for details.

🐛 Issues

If you encounter any issues or have feature requests, please file them on the GitHub issues page.

Made with ❤️ for "assemblers"