Write an interpreter for my esoteric language Jumper I have thought up esoteric language Jumper. Later you will see why.


It operates with random-access-memory with bytes as cells. RAM is zero indexed and initially filled with zeros.
When trying access cells with negative indexes error should be displayed and program terminated.
When trying read at larger index than last, zero should be returned.
When trying write at larger index than last, RAM should be increased to multiple of 1024 and new cells filled with zeros (technically you can increase RAM not to multiple of 1024, reason was performance boost, so if it costs you a lot of characters you can do it not to multiple of 1024).
Program also has pointer to cell in RAM which initially is zero
When program starts executing a prompt for input string should be displayed (or take input from command line arguments, it's up to you). Input string should not contain null character (zero byte). Then input string is written to RAM starting at zero index.
When program ends executing a box with program output is displayed - contents of RAM from zero index to first zero byte excluding.


Now, most interesting part, syntax.

Program consists of commands (unary operators-prefixes) and their arguments. Commands and arguments may be delimited with spaces or new lines but not necessary. However spaces inside arguments are invalid, for example, # 2 = 4 is valid, but # 2 = 4 4 is not.
Program can have comments between (). Comments can't be nested - for example, in (abc(def)ghi) comment is (abc(def). Comments can be placed anywhere.


#123 sets RAM pointer to 123 (any positive decimal integer or zero).
&gt;123 increments RAM pointer by 123 (any positive decimal integer).
&lt;123 decrements RAM pointer by 123 (any positive decimal integer).
=123 writes 123 (any unsigned 8-bit decimal integer) in current cell.
+123 adds 123 (any unsigned 8-bit decimal integer) to current cell (modulo 256).
-123 subtracts 123 (any unsigned 8-bit decimal integer) from current cell (modulo 256).
:123 - "goto" - goes to command number 123 (first is 0). You can control flow of your program only with goto's - it has to jump - that's why I decided to call this language Jumper.


If argument is missing - think of it is 1 for &gt;&lt;+- commands or 0 for #=: commands.

Also, there is command modifier - ? (prefix to command), it executes next command only if current cell is not zero, else skips that command. Can be applied to any command.
For example, ?:17 - goes to command 17 if current cell is not zero.

If program is invalid or error occurs during runtime can be displayed message "Error". Because of this is CodeGolf, such short message will be fine.

Your task

Write shortest interpreter for this language.

Some test programs

(prints "Hello world!" regardless of input)
=72&gt;=101&gt;=108&gt;=108&gt;=111&gt;=32&gt;=119&gt;=111&gt;=114&gt;=108&gt;=100&gt;=33&gt;=

(appends "!" to the end of input string)
?:2 :4 &gt;1 :0 =33 &gt;1 =0
Ruby, 447 bytes

p,i=$*
l=(i||'').length
r=[0]*l
l.times{|j|r[j]=i[j].ord}
i=j=0
s=p.gsub(/\(.*?\)|\s/,'')
q=s.scan(/(\?)?([#&lt;&gt;=+:-])(\d*)/)
e=-&gt;{abort"Error"}
p[/\d\s+\d/]||q*''!=s ?e[]:(r+=[0]until i+1&lt;r.length
c=q[j]
j+=1
f=c[1]
c[0]&amp;&amp;r[i]==0?next: a=c[2]==''? '&gt;&lt;+-'[f]?1:0:c[2].to_i
'=+-'[f]&amp;&amp;a&gt;255?e[]: f==?#?i=a :f==?&gt;?i+=a :f==?&lt;?i-=a :f==?=?r[i]=a :f==?+?r[i]+=a :f==?-?r[i]-=a :j=a
i&lt;0?e[]:r[i]%=256)while j&lt;q.length
puts r.first(r.index 0).map(&amp;:chr)*''


Takes both the program and the input via command line arguments.

EDIT: Fixed a few bugs, and added support for invalid syntax at the cost of 40 bytes (while adding a few other optimisations).