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

@netwan/lava

v1.0.4

Published

LavaX C compiler and virtual machine - An embedded C language compilation system for compiling and running .lav bytecode

Downloads

423

Readme

LavaX 编译器与虚拟机

LavaX 是一个嵌入式 C 语言编译器和虚拟机系统,用于编译和运行 .lav 格式的 LavaX 程序。

平台支持

| 平台 | 架构 | 状态 | |------|------|------| | Linux | x64 | ✅ 支持 | | Linux | arm64 | ✅ 支持 | | Windows | x64 | ✅ 支持 |

安装

npm install -g @adouming/lava

安装后,以下命令将可用:

  • lc - LavaX 编译器
  • lvm1 - SDL1 版虚拟机
  • lvm2 - SDL2 版虚拟机
  • lpp - 预处理器

项目组成

  • lc - LavaX 编译器,将 C 源码编译为 .lav 字节码
  • lpp - LPP 预处理器(基于 tinycc 移植)
  • lvm2 - SDL2 版 LavaX 虚拟机(基于sdl2,纯gui,无控制台)
  • lvm1 - SDL1 版 LavaX 虚拟机(基于sdl1,兼容cli模式,终端有stdout和stdin)

lc 编译器新功能

语法新特性

| 特性 | 说明 | |------|------| | typedef | 支持 typedef 类型定义 | | enum | 支持枚举类型 | | #encoding utf8 | 支持 UTF-8 编码的源代码 | | 局部变量任意位置定义 | 使用 -a 参数允许在代码任意位置定义局部变量 | | 变参函数 | 支持可变参数函数 | | 复杂宏定义 | 支持复杂宏定义 | | switch 语句 | 支持 switch 分支语句 | | 三目运算 | 支持 A ? B : C 三目运算符 | | 彩色错误输出 | 支持彩色错误输出 | | yield 语句 | 生成式函数指令,编译期协程支持 | | 跨平台支持 | 同时支持win和linux 环境 |

预处理器

  • LPP 预处理器:基于 tinycc 预处理器移植,替代 GNU cpp
  • 支持 LavaX 特殊指令:#width, #height, #color, #pen, #autoscreen, #watch, #secret, #loadall, #bigram, #encoding

编译器功能

  • 调试模式:使用 -v 参数显示详细调试信息

## 使用方法(npm 安装后)

### lc 编译器

```bash
# 基本编译
lc source.c -o output.lav

# 允许任意位置定义局部变量
lc source.c -o output.lav -a

# 显示调试信息
lc source.c -o output.lav -v

# 显示帮助
lc --help

lvm2 虚拟机(图形模式)

# 打开指定的 .lav 文件
lvm2 game.lav

# 打开目录(自动查找第一个 .lav 文件)
lvm2 /path/to/games/

# 不带参数(暂时不支持 Shell)
lvm2

# 显示帮助
lvm2 --help

lvm1 虚拟机(主要用于控制台模式debug,和AI交互)

# 运行 .lav 文件
lvm1 game.lav

# 显示帮助
lvm1 --help

lpp 预处理器

# 预处理 C 源码
lpp source.c -o output.i

键盘控制映射

| 游戏按键 | 键盘按键 | |---------|---------| | 方向键 || | ↑ | ↑ (Up Arrow) | | ↓ | ↓ (Down Arrow) | | ← | ← (Left Arrow) | | → | → (Right Arrow) | | 游戏按钮 || | A | LSpace | | B | KLeft Ctrl | | X | PLeft Shift | | Y | OLeft Alt | | 肩键 || | L1 | TabPageUp | | R1 | BackspacePageDown | | 系统按键 || | Select | 5Right Ctrl | | Start | 6Enter | | 特殊功能 || | 退出当前程序 | Enter (单独按下) 或 ESC | | 退出虚拟机 | Select + Start 同时按下 | | 切换网格显示 | R1 + Select | | 切换FPS显示 | L1 + Select |

手柄支持

程序支持标准游戏手柄,按键映射会根据手柄类型自动适配(Xbox 布局或标准布局)。

显示模式

  • 桌面分辨率 > 1024x600:使用 640x480 窗口模式
  • 桌面分辨率 ≤ 1024x600:使用全屏模式

目录结构

LavaXOS/
├── System/
│   ├── ShellX.sys    # 默认 Shell 程序
│   └── Config.ini    # 配置文件
└── ...

许可证

(待补充)