Question

This question might be a bit pointless, but I thought it was interesting and I don't know how to find an answer to it otherwise.

I wrote a brainfuck interpreter that takes programs (or file paths) as arguments from the command line; i.e.

brainfuck >++++++++[<++++++++>-]<.

outputs @. Or, it's supposed to, anyway. Actually running this in cmd gives an "Access is denied" error if the argument is not enclosed in double quotes. I assume it has something to do with cmd trying to parse the square brackets; do they have any particular function in cmd?

Was it helpful?

Solution

Your problem are not square backets. You problem are < and >. They are intended to handle stream redirection, < xxx means get input from xxx, > xxx means send output to xxx

You can enclose the text in double quotes or can escape the "problematic" characters preceding them with a caret

brainfuck ">++++++++[<++++++++>-]<."
brainfuck ^>++++++++[^<++++++++^>-]^<.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top