Execute Brain****/TI-89 BASIC: Difference between revisions

m
Fixed syntax highlighting.
(add TI-89 BASIC as translation of TI-83)
 
m (Fixed syntax highlighting.)
 
(5 intermediate revisions by 5 users not shown)
Line 1:
[[Category:TI-89 BASIC]]{{implementation|Brainf***}}{{collection|RCBF}}
 
{{trans subpage|TI-83 BASIC|subpage=1}}
 
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.
 
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.
 
<presyntaxhighlight stylelang="font-family:'TI Uni'ti89b">Define bf(Raw) = Prgm
Local valid, raw, BFprog, inst, memory, ip, brackets, memp
"+-.,[]<>" → valid
Line 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 73:
EndIf
EndFor
EndPrgm</presyntaxhighlight>
9,482

edits