Links of the Week

In order to keep this blog up to date I decided to create this periodic blog post format called Links of the week where I share all of my findings during the past week.

  • The first link I wanna share is a YouTube video, actually a talk from Alex Gaynor (yes one of the contributor of PyPy), with the title "So you want to write an interpreter?" from PyCon'13. It just gives a pretty quick review about the basic concepts for writing an interpreter for a custom DSL, such as Lexer, Parser, AST, Bytecode-compiler and Bytecode-interpreter. If you are a rusty about these basic concepts give it a shot.
  • Well you may wonder how come I found this video. That's simple. I was looking at the implementation of Hy language, a Lisp dialect that's embedded in Python. Hy simply uses a the rply lexer (that is a port of David Beazley's PLY to RPython created by Alex Gaynor) to create AST trees which are remapped to Python AST tress (using the ast module) and compiled seamlessly in python bytecode. If you wanna give it a try there's also an online interpreter where you can eval hy code on the fly. You can try some fibonacci code:
Fibonacci inHy
1
2
3
4
    (defn fibo [n]
      (if (<= n 1)
        n
        (+ (fibo (- n 1)) (fibo (- n 2)))))
  • Interested in some black security magic? I also found source code of azazel an interesting userland rootkit that exploits LD_PRELOAD for hiding his presence.

  • Ok probably we are getting too serious. Better take a break and play Flappy Bird, using reinforcement learning. The code of this funny experiment can be found here.

See you next week!