LavStudio is a modern, web-based IDE and emulator for the LavaX platform — a C-like language designed for classic handheld electronic dictionaries (文曲星/WQX). It provides a complete browser-based development environment: write, compile, run, and decompile LavaX programs without installing anything.
- Integrated IDE — Dark-themed editor with syntax highlighting for LavaX C (GVM C).
- LavaX Compiler — Compiles C-like source code into assembly intermediate code and then to
.lavbinaries. - Assembler & Disassembler — Converts between assembly text and
.lavbinary format. - LavaX Virtual Machine (GVM) — A 32-bit stack-based VM that faithfully emulates the target hardware.
- Hardware Simulation — 160×80 monochrome display, GBK bitmap fonts, keyboard input, and basic sound.
- VFS (Virtual File System) — Persistent in-browser file storage backed by IndexedDB.
- Decompiler — Reverse-engineer
.lavbinaries back to assembly or C source.
| Framework | React 18 |
| Build Tool | Vite 6 |
| Package Manager | Bun |
| Language | TypeScript 5.8 |
| Styling | Tailwind CSS 4 |
| Icons | Lucide React |
| Encoding | iconv-lite (GBK ↔ UTF-8) |
| Polyfills | vite-plugin-node-polyfills |
LavStudio/
├── src/
│ ├── compiler.ts # LavaX C → Assembly compiler
│ ├── decompiler.ts # .lav → Assembly / C source decompiler
│ ├── vm.ts # LavaX Virtual Machine core (GVM)
│ ├── types.ts # Shared types, enums (Op, Syscall), constants
│ ├── index.tsx # Main React app / IDE orchestration
│ ├── index.css # Global styles (Tailwind)
│ ├── compiler/
│ │ └── LavaXAssembler.ts # Assembly → .lav binary assembler
│ ├── vm/
│ │ ├── GraphicsEngine.ts # 160×80 screen emulation & drawing primitives
│ │ ├── SyscallHandler.ts # System call dispatcher (0x80–0xDF)
│ │ ├── VirtualFileSystem.ts # In-memory VFS with IndexedDB persistence
│ │ └── VFSStorageDriver.ts # IndexedDB storage backend
│ ├── components/
│ │ ├── Editor.tsx # Code editor with syntax highlighting
│ │ ├── Device.tsx # Device emulator display
│ │ ├── FileManager.tsx # VFS file manager UI
│ │ ├── SoftKeyboard.tsx # On-screen keyboard (文曲星 layout)
│ │ ├── Terminal.tsx # Output terminal
│ │ └── dialogs/ # Modal dialog components
│ ├── hooks/
│ │ └── useLavaVM.ts # React hook connecting the VM to the UI
│ └── i18n/
│ └── index.ts # UI internationalization strings
├── public/
│ └── fonts.dat # Bitmap font data (16×16 and 12×12, GBK)
├── docs/ # Technical specifications and documentation
│ ├── lav_format.md # .lav file format & full instruction set
│ ├── LavaX-docs.md # LavaX language reference manual
│ └── ai/ # AI-assistant documentation
├── tests/ # Test scripts (run with Bun)
├── examples/ # Sample LavaX C programs
├── PROJECT_STATUS.md # Current status, known issues & roadmap
└── vite.config.ts # Vite configuration
- Bun installed on your machine.
# Clone the repository, then:
bun installbun run devOpen http://localhost:5173 in your browser.
bun run build # outputs to dist/
bun run preview # serve the production build locallyThe editor supports LavaX C syntax (a subset of C). Click BUILD to compile to assembly and .lav binary.
Click RUN to launch your program in the emulator. Use the on-screen keyboard or your physical keyboard to interact.
The Filesystem tab lets you upload .lav files into the VFS, download compiled binaries, or delete files.
With a .lav file in the VFS, click RECOVER to decompile it back to assembly or C source.
| Document | Description |
|---|---|
| LAV Format & Instruction Set | Binary format spec, all opcodes and system calls |
| LavaX Language Manual | Language syntax, data types, standard library |
| Project Status & Roadmap | Current state, known issues, priorities |
| AI Assistant Docs | Module interfaces, quick reference, test cases |
This project is deeply inspired by and references the official LavaXVM project. Special thanks to the original creators and maintainers of the LavaX platform.
Distributed under the MIT License. See LICENSE for more information.