added _main

This commit is contained in:
Luxferre
2026-07-04 09:30:02 +03:00
parent ce18aa76b5
commit 0beaa27fe7
3 changed files with 12 additions and 4 deletions
+5 -1
View File
@@ -123,7 +123,11 @@ class Clyx:
run = lambda self, code: self._exec_quot(self._tokenize(code))
def clyx(f):
try: Clyx().run(open(f).read())
try:
c = Clyx()
c.run(open(f).read())
if '_main' in c._words:
c.run('_main')
except Exception as e: (sys.stderr.write(f'Error executing {f}: {e}\n'), sys.exit(1))
repl = lambda: clyx(replpath)