Way to import list of functions for Befunge-98 interpreter

90 views Asked by At

I have found a really great Befunge interpreter, and am trying to add simple importing of fingerprints and their corresponding functions from a file. My current code uses classes for each of the functions, and then assigns the functions under a fingerprint, and then under a letter. This is how the original code, and my current code works. I was hoping to import a file named fingerprint.py as a module, and then run fingerprint.initiate() or something of the sort to add the fingerprints to the fingerprint dictionary. It is in the interpreter file, and I am trying to use the code:

global fingerDict   
fingerDict += 0x4567890: {'A': FUNC.A}  

to add the fingerprint data to the dictionary, and it doesn't allow me to do it, saying it has a syntax error. I have no idea how I should instantiate the classses. The full code is here Any answers are heavily appreciated, and I would love to mention you in my upcoming publishing og the code. Thanks, and have a good day.

1

There are 1 answers

0
Desktop Firework On

You can use fingerDict.__setitem__(0x4567890, {'A': FUNC.A}).

Alternatively, fingerDict[0x4567890] = {'A': FUNC.A} will also work, as said Claudiu.