🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

stack-vm

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stack-vm

A simple stack machine simulator written in typescript

latest
Source
npmnpm
Version
0.5.7
Version published
Weekly downloads
27
285.71%
Maintainers
1
Weekly downloads
 
Created
Source

stack-vm - A simple stack virtual machine simulator

Note This project can be tested online at https://npm.runkit.com/stack-vm. Currently no graphical functions are implemented.

Installation

Note Requires a recent version of NodeJS and NPM installed on the system

To use the program as a command line application, install like so:

npm install -g stack-vm

To use the program using the JavaScript API, then run the comman:

npm install --save stack-vm

Command Line

Run the command:

stack-vm run ./source-code.vm

If you want to execute the program step by step, execute as follows:

stack-vm run --step-by-step 1 ./source-code.vm

JavaScript API

import { StackVM, StdActions, Parser } from "./index";

const instructions = Parser.parse( `
start
pushi 2
writei
pushs "\n"
writes
stop
` );

const vm = new StackVM( StdActions, instructions );

vm.executeAll()
    .catch( error => console.error( error.message, error.stack ) );

FAQs

Package last updated on 12 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts