equal
deleted
inserted
replaced
468 |
468 |
469 In the extended \texttt{compute3} and \texttt{run3} functions you should |
469 In the extended \texttt{compute3} and \texttt{run3} functions you should |
470 implement this command by writing 0 to \pcode{mem(mp)}, that is use |
470 implement this command by writing 0 to \pcode{mem(mp)}, that is use |
471 \pcode{write(mem, mp, 0)} as the rule for the command \texttt{0}. |
471 \pcode{write(mem, mp, 0)} as the rule for the command \texttt{0}. |
472 The easiest way to modify a string in this way is to use the regular |
472 The easiest way to modify a string in this way is to use the regular |
473 expression \pcode{"""[^<>+-.\\[\\]]"""}, which recognises everything that is |
473 expression \pcode{"""[^<>+\\-.\\[\\]]"""}, which recognises everything that is |
474 not a bf-command. Similarly, the |
474 not a bf-command. Similarly, the |
475 regular expression \pcode{"""\\[-\\]"""} finds all occurrences of \pcode{[-]}. By using the Scala method \pcode{.replaceAll} you can replace substrings |
475 regular expression \pcode{"""\\[-\\]"""} finds all occurrences of \pcode{[-]}. By using the Scala method \pcode{.replaceAll} you can replace substrings |
476 with new strings.\\ |
476 with new strings.\\ |
477 \mbox{}\hfill{[1 Mark]} |
477 \mbox{}\hfill{[1 Mark]} |
478 |
478 |