-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathltx_env.py
More file actions
35 lines (28 loc) · 880 Bytes
/
ltx_env.py
File metadata and controls
35 lines (28 loc) · 880 Bytes
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
34
35
from lite_vm import LiteVM
from lite_parser import LiteParser
def main():
vm = LiteVM()
parser = LiteParser(vm)
print("LTX Environment (type 'exit' or 'quit' to leave)")
print("Type blank line to execute a command sequence\n")
buffer = []
while True:
try:
line = input("LTX > ").strip()
if line.lower() in ("exit", "quit"):
print("Exiting LTX.")
break
# detect command sequence boundary
if line == "":
if buffer:
parser.parse("\n".join(buffer))
buffer.clear()
continue
buffer.append(line)
except KeyboardInterrupt:
print("\nExiting LTX.")
break
except Exception as e:
print("Error:", e)
if __name__ == "__main__":
main()