Thursday, June 30, 2011

Visualizing parsers

Parcon 0.1.22 is out, with a really cool new feature: parser visualization. Parcon now includes the ability to generate graphs from parsers that describe what those parsers do.

There are still some kinks to be worked out, and I'll save a detailed blog post on Parcon graphing for when those are fixed, but the basic thing works. For example, the expression evaluator Parcon example (which is present on the PyPI page for Parcon), when converted to a graph via this:
term.graph().draw("test-graph2.png")

results in this (click on the image to view a larger version):



In order for graphing to work, you have to have Graphviz installed, and specifically you need to have the dot program installed. You do not, however, need this installed to use Parcon, and in fact, you don't even need it to call graph(); you just need it when you actually call draw().

You'll probably notice some of the kinks. Two of the major ones are that InfixExpr doesn't display any representation of the functions it was passed, and the child parsers for Then and First are displayed out of order. Once I get those, and a few others, solved, I'll write a more detailed post on visualizing parsers with Parcon.

But you've got to admit, even as it is it's pretty cool.

4 comments:

  1. The site is down ATM. http://www.isup.me/http://www.opengroove.org/

    ReplyDelete
  2. Thanks for letting me know. It turned out it was due to a circuit breaker tripping. (I wrote a post a few hours ago on the blog explaining it.) It's back up now, though, thank goodness.

    ReplyDelete
  3. The Poker Room at the Wynn | Mapyro
    목포 출장마사지 pin › poker › pin › poker Poker Room at the Wynn 동해 출장안마 · Encore 나주 출장샵 Lobby · Poker Room · Table Games · Poker Room. The Wynn 당진 출장샵 poker room features some of the biggest poker 양산 출장안마 tournaments around.

    ReplyDelete
  4. This could be be} anyplace from 24 hours to 30 days, relying on the terms and situations of the particular offer. The casinos to steer clear from are those that require you to maintain spinning until you attain an quantity within the region of x100, and solely then are you able to} cash out. Oftentimes, this may involve adding a few of your own dollars… which is the place the enjoyable tends 온라인카지노 to stop. Customers can use Bitcoin, Bitcoin Cash, Litecoin, and Ethereum to make payments and withdrawals at Ignition. Not to mention the impressive customer service out there round the clock.

    ReplyDelete