Execute Brain****/TI-89 BASIC: Difference between revisions
m
Fixed syntax highlighting.
m (moved RCBF/TI-89 BASIC to Execute Brain****/TI-89 BASIC) |
m (Fixed syntax highlighting.) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 1:
{{implementation|Brainf***}}{{collection|RCBF}}
{{trans
This implementation (in [[TI-89 BASIC]]) is basically a direct translation of the [[RCBF/TI-83 BASIC|TI-83 BASIC example]]. It makes use of some TI-89 features; the program and memory size are given as parameters, and all variables are declared local.
Line 7:
IO is performed with numbers; character IO could be done (using char() and ord() to convert) but the TI-89 has no cursor for user program IO, so it would be necessary to either implement one or buffer output until the program exits or waits for input, in order to display more than one character per line.
▲<pre style="font-family:'TI Uni'">Define bf(Raw) = Prgm
Local valid, raw, BFprog, inst, memory, ip, brackets, memp
"+-.,[]<>" → valid
Line 56 ⟶ 55:
While ip≥0 and brackets ≠ 0
If mid(BFprog,ip,1) = "[" Then
brackets-1 → brackets▼
ElseIf mid(BFprog,ip,1) = "]" Then▼
brackets+1 → brackets
▲ ElseIf mid(BFprog,ip,1) = "]" Then
▲ brackets-1 → brackets
EndIf
ip-1 → ip
Line 74 ⟶ 73:
EndIf
EndFor
EndPrgm</
|