Code Monkey home page Code Monkey logo

gohackvm's Introduction

$ go get github.com/papplampe/gohackvm
$ ./gohackvm
Usage of gohackvm:
  -c="": code to be executed
  -cf="": file containing code to be executed
  -l=false: shall the stack be logged
  -m="": the initial memory (cell0,cell1,...)
  -mf="": file containing initial memory (cell0,cell1,...)


Interprets following "bytecodes":
' ': Do nothing (used for readability purposes)
'p': Print S0 as an integer
'P': Print S0 as an ASCII character (only the least significant 7 bits of the value are used)
'0'..'9': Push the value 0..9 on the stack
'+', '-', '*', '/': Push S1+S0, S1-S0, S1*S0, S1/S0
':': Push -1 if S1<S0, 0 if S1=S0, or 1 S1>S0
'g': Add S0 to the program counter
'?': Add S0 to the program counter if S1 is 0
'c': Push the program counter on the call stack and set the program counter to S0
'$': Set the program counter to the value popped from the call stack
'<': Push the value of memory cell S0
'>': Store S1 into memory cell S0
'^': Push a copy of S<S0+1> (ex: 0^ duplicates S0)
'v': Remove S<S0+1> from the stack and push it on top (ex: 1v swaps S0 and S1)
'd': Drop S0
'!': Terminate the program


for more about hackvm see
	http://progopedia.com/language/hack-vm/
	http://www.hacker.org/hvm/

gohackvm's People

Contributors

henkman avatar

Watchers

Antony Ingram avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.