0

Related to question at How to run Esoteric Language ZOMBIE

I realize there is an interpreter ( http://esolangs.org/wiki/User:Marinus/ZOMBIE_interpreter )to run the ZOMBIE language in a python environment, what I don't understand is how to use the interpreter (or any interpreter in general).

Do I save this in a .py file and use the import command? Or execFile? Then just write code in ZOMBIE?

Community
  • 1
  • 1

1 Answers1

2

This interpreter is written in Python, so save it as zombie.py. Write your ZOMBIE program in a separate file, something like myzombiefile.z. If you are running it on Windows, you'll need to run it using python as in:

python zombie.py myzombiefile.z

If you are running on Linux, you can just chmod zombie.py to be executable using:

chmod +x zombie.py

and then have it interpret your ZOMBIE program using:

zombie.py myzombiefile.z
PaulMcG
  • 62,419
  • 16
  • 94
  • 130
  • On Unix, you can also add a shebang line like `#!/usr/bin/env zombie.py` or `#!path/to/zombie.py` as the very first line of your program and just use `./myzombiefile.z` to run it. The `env` solution is somewhat more portable, especially if you have `zombie.py` in a nonstandard location. (This assumes that Zombie can accept a shebang line; in many languages, `#` is a comment character.) – tripleee Dec 17 '12 at 04:52
  • ... Upon closer examination, you might need to tweak `comment_re` in the interpreter code to also accept something like `\A#![^\n]*\n` as a comment. (Untested.) – tripleee Dec 17 '12 at 05:01
  • Just to be completely clear, where do the files zombie.py and myzombiefile.z need to be placed in order to use the Windows example? Sorry,though I have added C:\Python27 to my PATH, I have no experience with command prompt. –  Dec 18 '12 at 03:15
  • There is nothing magic about these files, they are just files. If a file is in the local directory, then you can access the file just using its name. If it isn't in the local directory, then you have to qualify the name with the reference to the directory where it is located. If it's on another disk, then you'll have to include the disk reference too. Python27 is in your PATH? Put zombie.py in c:\python27\Lib\site-packages. Then you can do `python -m zombie myzombiefile.z`. `myzombiefile.z` can be anywhere - I suggest you create a directory to organize your work - don't put everything on C:\. – PaulMcG Dec 18 '12 at 13:34