Warning: this is an htmlized version!
The original is across this link,
and the conversion rules are here.
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> require "treetex"
> require "rect"
> addabbrev("->", "\\to")
> TN = function (root, b, l, ...)
>>     return TreeNode {[0]=root, bar=b, label=l, ...}
>>   end
> T = TN("Q->R", "-", "app",
>>        TN("P"),
>>        TN("P->(Q->R)"))
> print(T:TeX_subtree("  "))
  \infer[{app}]{ \mathstrut Q\toR }{
   \mathstrut P &
   \mathstrut P\to(Q\toR) }
> print(T:TeX_deftree("f(1+2+3)"))
\defded{f(1+2+3)}{
 \infer[{app}]{ \mathstrut Q\toR }{
  \mathstrut P &
  \mathstrut P\to(Q\toR) } }
> = dedtorect(T)
P  P->(Q->R)
------------app
Q->R
> 
>