Created
April 15, 2013 19:50
-
-
Save dustinboston/5390799 to your computer and use it in GitHub Desktop.
A sweet.js macro for Python. See https://groups.google.com/forum/#!topic/sweetjs/n82-yrjXhgo for more info.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro python { | |
case print $params (,) ... => { | |
console.log(( $params (,) ... )) | |
} | |
// Function definition | |
case def $name:ident ( $params (,) ... ) : $a $b ... => { | |
function $name( $params (,) ... ) { python $a $b ... } | |
} | |
// Function call | |
case $name:ident ( $params (,) ... ) => { | |
$name(( $params (,) ... )) | |
} | |
} | |
python | |
def sweet(msg): | |
print msg | |
sweet("Macros are sweet!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment