Warning: this is an htmlized version!
The original is here, and
the conversion rules are here.
-- This file:
--   http://angg.twu.net/LUA/Lisp1.lua.html
--   http://angg.twu.net/LUA/Lisp1.lua
--           (find-angg "LUA/Lisp1.lua")
-- Author: Eduardo Ochs <eduardoochs@gmail.com>
--
-- Parse Lisp with Lpeg, and draw the result as a tree.
--
-- (defun e () (interactive) (find-angg "LUA/Lisp1.lua"))
-- (find-es "lpeg" "globals")
-- (find-es "lpeg" "lpeg-quickref")

require "Tree1"    -- (find-anggfile "LUA/Tree1.lua")
require "lpeg"

B,C,P,R,S,V = lpeg.B,lpeg.C,lpeg.P,lpeg.R,lpeg.S,lpeg.V
Cb,Cc,Cf,Cg = lpeg.Cb,lpeg.Cc,lpeg.Cf,lpeg.Cg
Cp,Cs,Ct    = lpeg.Cp,lpeg.Cs,lpeg.Ct
Carg,Cmt    = lpeg.Carg,lpeg.Cmt

packlist = function (a, ...)
    if type(a) == "string" then return Tree {[0]=a, ...} end
    return Tree {a, ...}
  end

sexp = P({
  "ssexp",
  spaces     = S(" \t\n")^1,
  optspaces  = S(" \t\n")^0,
  symbolchar = R("!~") - S([[()"\]]),
  symbol     = V"symbolchar" ^ 1,
  sexp       = C(V"symbol") + V"list",
  list       = ("(" * V"optspaces" * (V"sexp" * V"optspaces")^0 * ")") / packlist,
  ssexp      = V"optspaces" * V"sexp",
})

str = "  ((MLIST SIMP) $X $Y $Z)"

str = [[ ((MEQUAL SIMP)
 ((%INTEGRATE SIMP) ((MTIMES SIMP) (($GP SIMP) $X) (($FP SIMP) (($G SIMP) $X)))
  $X $A $B)
 ((%INTEGRATE SIMP) (($FP SIMP) $U) $U (($G SIMP) $A) (($G SIMP) $B)))
]]

--[==[
* (eepitch-lua51)
* (eepitch-kill)
* (eepitch-lua51)
dofile "Lisp1.lua"

= sexp:match(str)

--]==]






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