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

Medusa - Final Draft - PyCon India 2014

Rahul De
September 21, 2014

Medusa - Final Draft - PyCon India 2014

The final draft for my presentation at PyCon India, 2014

Rahul De

September 21, 2014
Tweet

More Decks by Rahul De

Other Decks in Technology

Transcript

  1. What she is Runs Python Faster Compiles to Dart Uses

    JIT and hotspot Extendable and Scalable
  2. InFile (Primary Key) Hash GenCode <absolute file path> <SHA 256>

    <dart code> “/home/Heisenberg/ hanoi.py” “345AEFF…” “import ‘dart:io’…”
  3. Python 2.7 Source Python AST Module AST Node Visitior Framework

    Dart Code Generator for every Node/Optimizer Final Stitched/ Optimized Dart Code
  4. The Python AST Module Module FunctionDef ‘TOH’ [n, x, y,

    z] Stmt If Compare (n, >, 0) Stmt CallFunc ‘TOH’ [n - 1, x, y, z] Stmt CallFunc ‘TOH’ [n - 1, z y, x] CallFunc ‘TOH’ [25, 1, 2, 3] The Abstract Syntax Tree for hanoi.py
  5. AST Node Visitor Framework FunctionDef ‘TOH’ [n, x, y, z]

    Stmt If Compare (n, >, 0) Stmt CallFunc ‘TOH’ [n - 1, x, y, z] Stmt CallFunc ‘TOH’ [n - 1, z y, x] The FunctionDef node being visited
  6. Optimised Dart Code Generator def TOH (n, x, y, z):

    if n > 0: TOH (n - 1, x, z, y) TOH (n - 1, z, y, x) TOH (n, x, y, z) { if (n > 0) { TOH (n - 1, x, z, y); TOH (n - 1, z, y, x); } }
  7. Final Stitched Dart Code import “file:////Users/Heisenberg/.medusa/lib/inbuilts.dart”; ! TOH (n,x,y,z) {

    if (n > 0) { TOH((n - 1), x, z, y); TOH((n - 1), z, y, x); } } ! main() { TOH($n(25), $n(1), $n(2), $n(3)); }