Execute SNUSP/F Sharp: Difference between revisions

m
Fixed syntax highlighting.
m (Fixed syntax highlighting.)
 
Line 4:
Bloated version below this modular version. Somehow this page has been set up so I can't seem to change the original comments to note this fact. Probably I'm just too dumb to know now.
<br clear=all>
===Modular SNUSP===
<langsyntaxhighlight lang="fsharp">open System
open System.Collections.Generic
 
Line 130:
while ip.Valid() do
interpretCmd() |> ignore
(!input).[!ptr]</langsyntaxhighlight>
===Bloated SNUSP===
Okay, I did the bloated version and made a few other changes. Using <code>*</code> rather than <code>~</code> for inputting a number because it's easy for <code>~</code> to get lost in the visual sea of characters that makes up the typical program. Also made separate classes for the engine and the IP. I allow for infinite data space in both directions and threads not waiting for input run while other threads are blocked on input. I tried this on all the programs I could find. There don't appear to be any which really utilize the 2D data space, but I tested it with some simple test programs and it seems okay.
<langsyntaxhighlight lang="fsharp">// Bloated RCSNUSP
open System
open System.Collections.Generic
Line 375:
let snusp = new SNUSP(pgm) // Create an engine
snusp.Execute() // and run the program with it
snusp.ReturnValue() // Return the return value</langsyntaxhighlight>
 
===Example Inputs===
<langsyntaxhighlight lang="fsharp">let p1 = @"
read two characters ,>,==\ * /=================== ATOI ----------\
convert to integers /=/@</@=/ * // /===== ITOA ++++++++++\ /----------/
Line 418:
\!\/\/\/
")
printfn "value = %d" (RCSNUSP @"6=@@@+@+++++#")</langsyntaxhighlight>
9,482

edits