diff options
Diffstat (limited to 'bytetunes.py')
-rwxr-xr-x[-rw-r--r--] | bytetunes.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bytetunes.py b/bytetunes.py index 1d2a8a7..8ed9641 100644..100755 --- a/bytetunes.py +++ b/bytetunes.py @@ -1,17 +1,25 @@ +#!/usr/bin/env python from expr import * import sys def play(s): - machine = parse(preparse(tokenize(s))[0]) + machine = parse(preparse(tokenize(s))) t = 0 while True: t += 1 sys.stdout.write(chr(execute(machine, t) & 0x000000FF)) def main(): - play("(t>>6)&(2*t)&(t>>1)") + if len(sys.argv) <= 1: + play("(t>>6)&(2*t)&(t>>1)") + elif sys.argv[1] == '--test': + test_tokenize() + test_preparse() + test_parse() + else: + play(sys.argv[1]) if __name__=='__main__': main() |