We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a03be48 commit 7aa502aCopy full SHA for 7aa502a
main.py
@@ -1,4 +1,6 @@
1
#!.venv/bin/python3
2
+import sys
3
+
4
import typer
5
from antlr4 import CommonTokenStream, InputStream, ParseTreeWalker
6
from rich.console import Console
@@ -90,8 +92,12 @@ def run(filename: str):
90
92
visitor = SemanticAnalyser()
91
93
visitor.visit(tree)
94
if parser.getNumberOfSyntaxErrors() == 0:
- visitor = Interpreter()
- visitor.visit(tree)
95
+ try:
96
+ visitor = Interpreter()
97
+ visitor.visit(tree)
98
+ except Exception:
99
+ err_console.print("[bold red]runtime error")
100
+ sys.exit(1)
101
102
103
if __name__ == "__main__":
0 commit comments