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

Monadic Parsing in Python

Monadic Parsing in Python

Oleksii Kachaiev

June 06, 2014
Tweet

More Decks by Oleksii Kachaiev

Other Decks in Programming

Transcript

  1. About me • CTO at Attendify.com • Erlang, Clojure, Go,

    Haskell • Fn.py library author • CPython & Storm contributor
  2. Won’t talk •What "monad" is •Why FP is cool (*)

    * you’ll understand it by yourself
  3. Tasks • Processing information from logs • Source code analysing

    • DSLs • Protocols & data formats • … and more
  4. Grammar block = ["const" ident "=" number {"," ident "="

    number} ";"] ["var" ident {"," ident} ";"] {"procedure" ident ";" block ";"} statement ! expression = ["+"|"-"] term {("+"|"-") term} ! term = factor {("*"|"/") factor} ! factor = ident | number | "(" expression ")" ! . . . .
  5. Links • "funcparselib" http://goo.gl/daidQY • "Monadic parsing in Haskell" http://goo.gl/gygNlM

    • "Higher-Order functions for Parsing" http://goo.gl/c8VOIZ • "Parsec" http://goo.gl/bdnDZQ • "Parcon" http://goo.gl/CT06S5 • "Pyparsing" http://goo.gl/gmr2lQ • "You Could Have Invented Monadic Parsing" http://goo.gl/h0rnOQ