Files
IMProved/README.md
2015-07-13 01:16:50 +02:00

973 B

###IMProved

IMProved aims to build an interpreter for IMP (based on this) that is fully documented, occassionally improved and embeddable into Python 3.

As you may notice, I am bad at documentation.

###Installation

The package has a setuptools toolchain, but is not (yet?) on pip, which means that installation has to be performed manually. The process looks like this:

git clone https://github.com/hellerve/IMProved
cd IMProved
python setup.py install

And you're good to go!

###Usage

Easy!

import improved

improved.callIMP("n := 5")
# this will return a dictionary containing the key/value pair n/5

For a less contrived example, let's calculate the nth fibonacci number where n is user input:

import improved

x = """
  n := read;
  fib := 1;
  while n > 1 do
    fib := n * fib;
    n := n -1
  end;
  write fib
"""

improved.callIMP(x)