Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

lmc-simulator

BenMagill8ISC1.4.0TypeScript support: included

A libaray that allows the simulation of LMC code

LMC, Simulator

readme

lmc-simulator

npm bundle size

Lmc-simulator is a library that allows LMC (Little Man Computer) code to be assembled and executed.

Installation

npm install lmc-simulator

Usage

var Machine = require("lmc-simulator")

var code = `
        INP
loop    OUT   
        STA count
        SUB # 2
        STA count
        BRP loop ; This is a comment
        HLT
one     DAT 1
count   DAT  
`

var lmc = new Machine()

lmc.loadToRAM(code)

lmc.run()