Univar

Univar is a Turing-complete language with only one variable. Code is interpreted as a series of statements that reassign the value of this variable to a new value constructed with various operators and function calls. Here's an example statement:

&,,

This is interpreted as "var = join(var,var)". The "var=" part is left out since all the statements assign a value to the variable, so the assignment is implicit. The join operator is written as "&" and uses prefix notation to eliminate the need for parenthesis. No separation between statements is needed either. "," represents the variable.

Operators
A special feature is that if a junction is called, the left member of the junction will be called, with a junction of the right member of the junction and the parameter as an argument (this serves to provide closures) - in other words, "$&abc" => "$a&bc". Also, the interpreter must allow for tail call optimization, otherwise there is no way to write a loop that doesn't overflow the call stack.

Cat
(&!?,>,$,,)$,,

Cat with termination on null byte
( &&,()&?  &&<<,$$>>,&()><,&&>>,<>,? &&<<,$$>>,&()><,&&>>,<>,?  &&<<,$$>>,&()><,&&>>,<>,? &&<<,$$>>,&()><,&&>>,<>,?  &&<<,$$>>,&()><,&&>>,<>,? &&<<,$$>>,&()><,&&>>,<>,?  &&<<,$$>>,&()><,&&>>,<>,? &&<<,$$>>,&()><,&&>>,<>,  &<,<>,  &,!<>>>>>>>>,<, &,!<>>>>>>>,<,  &,!<>>>>>>,<,   &,!<>>>>>,<,  &,!<>>>>,<,     &,!<>>>,<,  &,!<>>,<,       &,!<>,<,  <,  $$>,<,<, )$,,

Brainfuck interpreter
NB: The BF code must NOT have comments or new lines or spaces or any other non-BF character. Use "]" between program and input. Integer terminator &($$>,&&&((>,))&&&&,) Integer &,($$>,&&&  ($<<,&(<,)$><,(<<<,))     &    &&($<<,&&(>,)&<><,$><,(<<>,)&(<,)><,)   (&&<<,&<><,$><,(><>,)>,&!<<,><,)  &($<<,&&(>,)><,&(<,)&<><,$><,(<>>,))   (&&<<,&<><,$><,(>>>,)>,&?><,) ,) &&>,&(>,)<,>,&&>,&(>,)<,>,&&>,&(>,)<,>,&&>,&(>,)<,>, &&>,&(>,)<,>,&&>,&(>,)<,>,&&>,&(>,)<,>,&&>,&(>,)<,>,<, Infinite stack &,($$>,&(<,)(&>,&<,>,)<,) &($>,<,)&<,&>,&<,>, Infinite tape &($$>,&&&  ($$<,(<,)(<<<,))   (&&$<,(<,)$<,(>,)>, &><,&<<,>, &<,&($>,<,)&<>,>>,)  &   (&<,&$>,(<,)$>,(>,) &&<>,<,>>, &&($>,<,)&<<,><,>,) &&(&&$<,(<,)$<,(>,)>, &&&<<<,$<<,(<<>,)><,>, &&($>,<,)&<<,><,>,)   (&&$<,(<,)$<,(>,)>, &&&<<<,$<<,(><>,)><,>, &&($>,<,)&<<,><,>,)  &(&&$<,(<,)$<,(>,)>, &&&<<<,$<<,(<>>,)><,>, &&($>,<,)&<<,><,>,)   (&&$<,(<,)$<,(>,)>, &&&<<<,$<<,(>>>,)><,>, &&($>,<,)&<<,><,>,) <,)&,, Build program from input &, ( <&,? <&,? $$?&  (   &,&&&(<<<,)(><<,)&(<><,)(>><,)&&(<<>,)(><>,)&(<>>,)(>>>,)   &<,$?>, <&,? <&,? &<,$?>, &<,$?>,   &($<<,&<>,$>,><,)&$<,<,>,  )  (   <&,? <&,? <&,? &,? <&,? $$>,&   (    &$,,$,,    &    (     &( $$$>>,(<<<,)&($<,&<,&<>,$<>,>>,)(>>,),),     &><>,$<,&<,&<<>,>>,      $<,>,    ),   )   ()<,  ), )&<,$>,>, Run $>,<,

Extra

 * 40006 byte quine.
 * Program that demonstrates addition with Church numerals (written by Fax).

Interpreter
This is written in the Lua programming language and will interpret Univar programs. program="COPY PROGRAM HERE" input_data="COPY INPUT DATA HERE" genlef = function(a) return a[1] end genrig = function(a) return a[2] end gencal = function(a,b) if(type(a)=="function") then return a(b) else return gencal(genlef(a),{genrig(a),b}) end end output_var = 0 output_bits = 0 genout = function(bit) output_var = output_var * 2 + bit output_bits = output_bits + 1 if (output_bits>7) then io.write(string.char(output_var)) output_var = 0 output_bits = 0 end end genoutf = function(p) gencal(gencal (p,{function(p)genout(1)return p end,function(p)genout(0)return p end}),function (p) return p end) return p end input_index = 1 input_bit = 128 genin = function local t = string.byte(input_data,input_index) if (t==nil) then return genrig end t = math.floor(t/input_bit) % 2 input_bit = input_bit / 2 if (input_bit<1) then input_bit = 128 input_index = input_index + 1 end if (t<1) then return genrig else return genlef end end program_index = 1 genexp = function local instr = string.sub(program,program_index,program_index) program_index = program_index + 1 if (instr=="&") then return "{"..genexp..","..genexp.."}" end if (instr=="<") then return "genlef("..genexp..")" end if (instr==">") then return "genrig("..genexp..")" end if (instr==",") then return "var " end if (instr=="(") then return "function (var)"..genfun.."return var end " end if (instr==")") then return "" end if (instr=="$") then return "gencal("..genexp..","..genexp..")" end if (instr=="!") then return "genoutf("..genexp..")" end if (instr=="?") then return "genin" end return genexp end genfun = function local exp = genexp if (exp=="") then return "" else return "var ="..exp..genfun end end program = program..")" translated_program = "compiled_function = function (var) "..genfun.."return var end " var = function (p) return p end assert(loadstring(translated_program)) assert(compiled_function(var))