5
1
Write a Brainfuck interpreter that can interpret multiple Brainfuck programs embedded within the same source. The syntax is the same except that the instructions must be prefixxed with the number/ID of the targetted program. Example:
1st program
+++[->+<]
2nd program
+>++>+++.
Mashup
1+1+1+2+2>1[1-2+2+2>1>1+2+1<2+1]2+2.
What is required:
- That it is theoretically able to interpret an unlimited number programs embedded within the same source.
- That the instruction order does not matter.
- That the code does not use features of a language that would natively solve this problem or natively interpret Brainfuck. Pretty much, don't cheat. I'll leave this to your discretion.
What is not:
- Unlimited Brainfuck storage. Only a minimum of 1000 Brainfuck cells per is imposed.
- It is not required that the input and output specify which bf program is doing the io. It'd be a cool feature tho, so if you do implement this you get -15 bytes.
You can do postfix if you want, just specify in that case. This is code-golf, so the smallest source in bytes (after the the -15 byte bonus) wins.
Could you be more specific as to how input/output is handled? – Shelvacu – 10 years ago
shelvacu: It's the brainfuck io that I was referring to. – user2958652 – 10 years ago
How will answers be scored? [tag:code-golf], [tag:popularity-context], or [tag:code-challenge]? Based on the mention of byte-count bonuses, I'm guessing [tag:code-golf], but please tag it as such. – Bob – 10 years ago
Are the ID's only numeric? – Οurous – 10 years ago
This is a relatively minor transformation of Interpret Brainfuck, and in my opinion is close enough to count as a duplicate.
– Peter Taylor – 10 years agoI agree with @PeterTaylor. In practice, you only need to split the input into the groups. The rest is a normal interpreter. Not sure this is really that much of a difference. – Ingo Bürk – 10 years ago
1I thought it was distinct enough, but fair enough. – user2958652 – 10 years ago