A high-fidelity architectural simulation of the JavaScript Event Loop and V8 runtime behavior. Engineered with Nuxt 4, this system utilizes AST (Abstract Syntax Tree) Parsing to deconstruct and visualize the execution of synchronous and asynchronous JavaScript operations in real-time.
- Runtime: Nuxt 4 (Future Compatibility Mode)
- Engine: Acorn.js (High-performance JavaScript Parser)
- State Management: Pinia (Virtual Machine State Tracking)
- Styling: Tailwind CSS (Monospace System Design)
- Rendering: Client-Side Only (SSR Disabled for direct Browser API interaction)
- AST-Driven Interpreter: Unlike a simple eval(), this system parses code into an Abstract Syntax Tree to control execution flow line-by-line.
- Concurrency Simulation: Implements a custom scheduler to demonstrate the priority difference between Microtasks (Promises) and Macrotasks (setTimeout).
- Virtual Machine State: Real-time tracking of the Call Stack (LIFO), Web APIs, and Task Queues (FIFO).
Ensure you have Node.js 20+ installed. Clone the repository and install dependencies:
npm installRun the development server on http://localhost:3000:
npm run devThe engine utilizes acorn to generate a node-based map of the source code. This ensures memory safety and allows the UI to "await" each execution step for visual clarity.
A dedicated background process (Event Loop) continuously polls the Call Stack. Once the stack is empty, it orchestrates the migration of tasks from the Microtask Queue, followed by the Macrotask Queue.
Utilizes Pinia stores to maintain an atomic record of the Virtual Machine state, ensuring reactive UI updates without triggering unnecessary re-renders in the Nuxt 4 reactive system.