Constructor
new BFProgram(instructionsList)
The constructor for a BF program
Parameters:
| Name | Type | Description |
|---|---|---|
instructionsList |
Array.<BFInstructions> | The instructions list |
- Source:
Methods
optimiseRLE(opSymbol, opReplacement)
Function to compress program using run length encoding for a given
operation. If a run of more than 1 operation is found then the sequence
of repeated operations is replaced with the opReplacement with an
additional parameter saying how many times it is to be repeated. This
function will also adjust the paired instructions to have the correct
jump locations.
this.instructionsList = ["__ADD_1__", "__ADD_1__","__ADD_1__"];
this.optimiseRLE("__ADD_1__", Add);
Updates this.instructionsList to ["__ADD_3__"];
Parameters:
| Name | Type | Description |
|---|---|---|
opSymbol |
BFInstruction.symbol | String of operation symbol |
opReplacement |
char | The character to compress |
- Source: