summaryrefslogtreecommitdiff
path: root/projects/hack-vm/utils.py
blob: 99c029aff3c40d1baf60f9de3a55719f2e945cbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
from sys import stderr

EXIT_CODE_FILE_ERROR = 1
EXIT_CODE_ILLEGAL_CHAR = 2
EXIT_CODE_SIZE_EXCEEDED = 3
EXIT_CODE_SYNTAX_ERROR = 4
EXIT_CODE_ADDR_ERROR = 5
EXIT_CODE_SYMBOL_ERROR = 6

def exit_on_error(msg, code):
    print(msg, file=stderr)
    exit(code)