6
1
Because we haven't had enough of these, let's do another weird language!
+
increments the accumulator-
decrements the accumulator#
outputs the character with the codepoint of the accumulator modulo 127, and then resets the accumulator$
is like#
but it doesn't reset the accumulator%
reads a single character of input and then set the accumulator to that. If it is EOF, exit the program!
sets the accumulator to 0
At the end of the program, if the accumulator is 0, exit, otherwise, start again from the beginning, preserving the accumulator state.
Note that this language has no implementation so it is defined by this post.
Challenge
Given a valid +-#$%!
program (containing only those characters) and the program input (containing only printable ASCII characters), return its output.
Examples
program, input -> output // comments
%$, hello -> hello // CAT program
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#++++++++++++++++++++++++++++++++#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++#, -> Hi there
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++$+++++++++++++++++++++++++++++++++$++++++++++++++++++++++++++++++++++++++++++++++++++++++$++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++$+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++$++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++$+++++++++++++$++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++$!, -> Hi there
5I promise you this is the last similar challenge you'll see from me for a long time. – HyperNeutrino – 2017-05-24T04:51:29.577
4so many "languages" even w/o turing complete... – tsh – 2017-05-24T05:30:23.237
1Shouldn't the
+
be a;
? – caird coinheringaahing – 2017-05-24T06:20:23.9271Also it's so great that all three ;# challenges are in the HNQ at the same time – caird coinheringaahing – 2017-05-24T06:21:51.347
Can we take the input for the program as list of characters? – ovs – 2017-05-24T07:31:57.827
3Next time, at least add some kind of control flow statements. – Sanchises – 2017-05-24T07:38:42.930
1Please rename this to 'Make a +-#$%! interpreter' to keep consistent. :P – totallyhuman – 2017-05-24T10:56:15.353
3I'm kinda getting tired of these... – programmer5000 – 2017-05-24T13:34:52.787
6If your going to make a language, make it Turing Complete. – mbomb007 – 2017-05-24T13:36:38.593
@tsh Just meant to be simple :) – HyperNeutrino – 2017-05-24T13:51:33.687
@RandomUser In the original one it was but now it's not :p – HyperNeutrino – 2017-05-24T13:51:51.217
@ovs Sure, you may. – HyperNeutrino – 2017-05-24T13:52:09.833
@Sanchises I've decided to not make a next time because people (cc programmer5000) are getting tired of these. – HyperNeutrino – 2017-05-24T13:52:30.550
@totallyhuman Okay sure :P – HyperNeutrino – 2017-05-24T13:52:40.967
@programmer5000 Okay sorry. I promise this is the last of these from me. No guarantees about other people :P – HyperNeutrino – 2017-05-24T13:53:02.237
@mbomb007 Again, just meant to be simple, but I am currently making a language that will hopefully be TC :P – HyperNeutrino – 2017-05-24T13:53:19.300
@HyperNeutrino oh come on! People can't be getting tired of this already, I'm nearly ready to release my new language,
+p
! :) – Socratic Phoenix – 2017-05-25T14:29:27.870