Well, one thing leads to another. With Lint.jl, I have been dumping Expr 
and looking up its structure.

Wouldn't it be great if I can browse Expr? So I wrote this:

https://github.com/tonyhffong/TermWin.jl

It's an interactive tree model navigator. It's not perfect. But I think 
it's useful. Like so:

Julia > using TermWin
Julia > ex = :( f(x) = x * x + 2x + 1 )
Julia > tshow( ex )

┌─────────────────────────────────────────────     7.41%──┐
│  +Expr           |Expr           |f(x) = x * x + 2x + 1 │
│  | +head         |Symbol         |=                     │
│  | +args         |Array{Any,1}   |Size=2                │
│  | | +[1]        |Expr           |f(x)                  │
│  | | | +head     |Symbol         |call                  │
│  | | | +args     |Array{Any,1}   |Size=2                │
│  | | | | +[1]    |Symbol         |f                     │
│  | | | | +[2]    |Symbol         |x                     │
│  | | | +typ      |DataType       |Any                   │
│  | | +[2]        |Expr           |x * x + 2x + 1        │
│  | | | +head     |Symbol         |call                  │
│  | | | +args     |Array{Any,1}   |Size=4                │
│  | | | | +[1]    |Symbol         |+                     │
│  | | | | +[2]    |Expr           |x * x                 │
│  | | | | | +head |Symbol         |call                  │
│  | | | | | =args |Array{Any,1}   |Size=3                │
│  | | | | | +typ  |DataType       |Any                   │
│  | | | | +[3]    |Expr           |2x                    │
│  | | | | | +head |Symbol         |call                  │
│  | | | | | +args |Array{Any,1}   |Size=3                │
│  | | | | | | +[1]|Symbol         |*                     │
│  | | | | | | +[2]|Int64          |2                     │
│  | | | | | | +[3]|Symbol         |x                     │
│  | | | | | +typ  |DataType       |Any                   │
│  | | | | +[4]    |Int64          |1                     │
└──────────────F1:Help  Spc:Expand  Esc:exit──────────────┘

I'm not a ncurses expert at all, so there're some random update issues that 
I cannot pin down.

It can browse a few things besides Expr, such as Module, Dict, Array, large 
strings.

As usual, any feedback/PR would be welcome.

Tony

Reply via email to