isaacg1 / pyth

Pyth, an extremely concise language. Try it here:
https://pyth.herokuapp.com/
MIT License
263 stars 57 forks source link

Add debug flag support to REPL mode #204

Closed vendethiel closed 8 years ago

vendethiel commented 8 years ago

Fixes #203.

I'm not "happy" with the flag parsing duplication, but the rest of the code uses sys.argv[1:-1] to remove the file (last arg), so we can't use that here... But that means ./pyth.py -rd won't work >.>

vendethiel commented 8 years ago
$ ./pyth.py -r --debug
Welcome to the Pyth REPL.
Each input line will be compiled and executed, and the results of
each one will be passed into the next one's input stream.

>>> 1
imp_print(1)
==================================================
1
>>> 6
imp_print(6)
==================================================
6
>>> y
assign('Q',eval_input())
imp_print(subsets(Q))
==================================================
12
>>> U
assign('Q',eval_input())
imp_print(urange(Q))
==================================================
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]