Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- This file:
--   http://angg.twu.net/LUA/SynTreeV1.lua.html
--   http://angg.twu.net/LUA/SynTreeV1.lua
--           (find-angg "LUA/SynTreeV1.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- (defun r () (interactive) (find-angg "LUA/Rect.lua"))

-- «.flipbook»	(to "flipbook")

require "Rect" -- (find-angg "LUA/Rect.lua")
               -- (find-angg "LUA/Rect.lua" "SynTree")

SynTreeV = Class {
  type = "SynTreeV",
  from = function (A) return deepcopymt(A, SynTreeV) end,
  tabletorect = function (o)
      local op = o[0]
      if type(op) == "number" then op = tostring(op) end
      if #o == 0 then return Rect.new(op or ".") end
      local o1r,o1v = SynTreeV.torectv(o[1])
      local r = o1r:syn1(op, o1v)
      for i=2,#o do
        local oir,oiv = SynTreeV.torectv(o[i])
        r = r:synconcat(oir, oiv)
      end
      return r
    end,
  torect = function (o) return (SynTreeV.torectv(o)) end,
  torectv = function (o)
      if type(o) == "number" then return Rect.new(o) end
      if type(o) == "string" then return Rect.new(o) end
      if type(o) == "table" then
        if o[0] == "S" then
	  return SynTreeV.torect(o[1]), (SynTreeV.S or "S")
	end
        return SynTreeV.tabletorect(o)
      end
    end,
  __tostring = function (o) return o:torect():tostring() end,
  __index = {
    torect = function (o)
        return SynTreeV.torect(o)
      end,
  },
}

draw = SynTreeV.from
draw = function (o)
    print()
    local st = SynTreeV.from(o)
    print((tostring(st):gsub("S", "∎")))
    print()
  end

eq  = function (a, b)   return {[0]="=", a, b} end
mul = function (a, b)   return {[0]="*", a, b} end
app = function (f, arg) return {[0]=f, arg} end
f   = function (arg) return app("f",  arg) end
fp  = function (arg) return app("f'", arg) end
g   = function (arg) return app("g",  arg) end
gp  = function (arg) return app("g'", arg) end
tan = function (arg) return app("tan", arg) end
int = function (f, x, a, b) return {[0]="int", f, x, a, b} end
S   = function (a) return {[0]="S", a} end
x,u,a,b = "x","u","a","b"
intl = int(mul(fp(g(x)),gp(x)),x,a,b)
intr = int(fp(u),u,g(a),g(b))
MV2  =  eq(intl,intr)
S0   = function (a) return {S(a)} end

-- «flipbook»  (to ".flipbook")
--[[
* (defun syntree-up   () (interactive) (search-backward ">>") (eek "M-6 C-l"))
* (defun syntree-down () (interactive) (search-forward  ">>") (eek "M-6 C-l"))
* (define-key eev-mode-map (kbd "<M-up>")   'syntree-up)
* (define-key eev-mode-map (kbd "<M-down>") 'syntree-down)
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "SynTreeV1.lua"



-- Situação inicial:
--  ((integral em x) =
--   (integral em u)  )[S1] = ?
--
= draw( S0( eq( int(mul(fp(g(x)),gp(x)),x,a,b),
                int(fp(u),u,g(a),g(b)) )))

-- Regra implícita pro "=":
--   (expr1     = expr2    )[S1] =
--   (expr1[S1] = expr2[S1])
--
= draw( eq( S(int(mul(fp(g(x)),gp(x)),x,a,b)),
            S(int(fp(u),u,g(a),g(b))) ))

-- Regra implícita pra integral:
--   (int(expr1    , expr2,     expr3,     expr4    )[S1] =
--   (int(expr1[S1], expr2[S1], expr3[S1], expr4[S1])
--
= draw( eq( int(S(mul(fp(g(x)),gp(x))),S(x),S(a),S(b)),
            int(S(fp(u)),S(u),S(g(a)),S(g(b))) ))

-- Regra implícita pro "*":
--   (expr1     * expr2    )[S1] =
--   (expr1[S1] * expr2[S1])
--
= draw( eq( int(mul(S(fp(g(x))),S(gp(x))),S(x),S(a),S(b)),
            int(S(fp(u)),S(u),S(g(a)),S(g(b))) ))

-- Regra explícita pro f'(expr):
--     (f'(expr1))[S1] =
--    (tan(expr1[S1]))
--
= draw( eq( int(mul(tan(S(g(x))),S(gp(x))),S(x),S(a),S(b)),
            int(tan(S(u)),S(u),S(g(a)),S(g(b))) ))

-- Regra explícita pro g(expr):
--    (      g(expr1)   )[S1] =
--    (2[S1] * expr1[S1])
--
= draw( eq( int(mul(tan(mul(S(2),S(x))),S(gp(x))),S(x),S(a),S(b)),
            int(tan(S(u)),S(u),mul(S(2),S(a)),mul(S(2),S(b))) ))

-- Regra explícita pro 2:
--    2[S1] =
--    2
--
= draw( eq( int(mul(tan(mul(  2 ,S(x))),S(gp(x))),S(x),S(a),S(b)),
            int(tan(S(u)),S(u),mul(  2 ,S(a)),mul(  2 ,S(b))) ))

-- Regra explícita pro a:
--    a[S1] =
--    3
--
= draw( eq( int(mul(tan(mul(  2 ,S(x))),S(gp(x))),S(x),  3 ,S(b)),
            int(tan(S(u)),S(u),mul(  2 ,  3 ),mul(  2 ,S(b))) ))

-- Regra explícita pro b:
--    b[S1] =
--    4
--
= draw( eq( int(mul(tan(mul(  2 ,S(x))),S(gp(x))),S(x),  3 ,  4 ),
            int(tan(S(u)),S(u),mul(  2 ,  3 ),mul(  2 ,  4 )) ))

-- Regra explícita pro g'(expr):
--    (g'(expr1))[S1] =
--          2
--
= draw( eq( int(mul(tan(mul(  2 ,S(x))),  2),     S(x),  3 ,  4 ),
            int(tan(S(u)),S(u),mul(  2 ,  3 ),mul(  2 ,  4 )) ))

-- Regra implícita pro u:
--    u[S1] =
--    u
--
= draw( eq( int(mul(tan(mul(  2 ,S(x))),  2),     S(x),  3 ,  4 ),
            int(tan(  u ),  u ,mul(  2 ,  3 ),mul(  2 ,  4 )) ))

-- Regra implícita pro x:
--    x[S1] =
--    x
--
= draw( eq( int(mul(tan(mul(  2 ,  x )),  2),       x ,  3 ,  4 ),
            int(tan(  u ),  u ,mul(  2 ,  3 ),mul(  2 ,  4 )) ))

--]]






-- Local Variables:
-- coding:  utf-8-unix
-- End: