Upgrade to Pro — share decks privately, control downloads, hide ads and more …

graaaph: A Library to Help Me Learn

graaaph: A Library to Help Me Learn

A presentation at NYC Clojure about the progress I'm making on a Ruby parsing and analysis library written in Clojure, using core.logic.


Michael Bernstein

May 16, 2013


  1. graaaph: A Library To Help Me Learn Michael R. Bernstein

    / NYC Clojure / May 15, 2013 @mrb_bk / github.com/mrb 1
  2. This Talk • Who Am I? • graaaph: The Library

    • Why? • Ruby • jruby-parser • Zippers • core.logic • Audience Participation 2
  3. Who am I? • Mike Bernstein a.k.a. “mrb” • Self-taught

    programmer • MFA in Design and Technology from Parsons, studied under Golan Levin and Zach Lieberman • Former Computer Science Educator, 5th-12th grades including AP Java • FT Professional Developer for ~6 years • Day Job is Ruby, JavaScript, and Go, but mostly people 3
  4. graaaph: Why? • To help me LEARN • I learn

    easily when I have a goal • Ruby lacks the tools we need • Clojure provides tools to make my goals simpler • An excuse to really dig into core.logic and relational programming in general • Likewise an excuse to learn and play with Zippers 4
  5. 5

  6. graaaph: Ruby • Is very complicated • Parsing it is

    a nightmare (Ruby’s parse.y is over 11,000 LOC - https://github.com/ruby/ruby/blob/ trunk/parse.y) • Doesn’t have the same kind of IDE integration as other languages • No decent refactoring tools • Not much in the way of commonly available static analysis tools in general 6
  7. graaaph: jruby-parser • A Ruby Parser written in Java •

    The same parser used by JRuby itself to parse Ruby Code • Takes Ruby Code and turns it into an AST format • AST has some nice built in visitor functions • Helped me understand how to work with trees better 7
  8. graaaph: Zippers • Zippers are really cool! • Excellent resource

    by Alex Miller (@puredanger) http://www.ibm.com/ developerworks/library/j-treevisit/index.html • Helpful for walking the AST and producing a seqable data structure in Clojure • Had the cool side effect of showing me how to use metadata 8
  9. graaaph: core.logic • I didn’t understand it, so I wanted

    to • Took me about a year to get any basic understanding, another year or so to start doing anything decent • Still not very good at it • But I’m trying really hard • And thankfully David Nolen is a mensch • graaaph is a good use case 9
  10. graaaph: The Basic Idea code.rb Java AST clojure Zipper seq

    of maps ????? newcode.rb 10
  11. Code Tour! 11

  12. Questions? (I have some for you) 12

  13. Thanks! michaelrbernstein@gmail.com twitter.com/mrb_bk github.com/mrb 13