blob: de19617d2c6680022d7caa137a7bb184b88a366f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/usr/bin/env python3
import sys
import actinide as a
import actinide.ports as ap
import actinide.types as at
def repl(session, port):
while True:
try:
sys.stdout.write("> ")
sys.stdout.flush()
form = session.read(port)
if form is None:
print()
return 0
results = session.eval(form)
print(*(at.display(result) for result in results))
except Exception as e:
print(e)
except KeyboardInterrupt:
print()
print("(Interrupted)")
def main():
port = ap.Port(sys.stdin)
session = a.Session()
return repl(session, port)
if __name__ == '__main__':
sys.exit(main())
|