From 937a043bf6380c3ef329c71b1879ef5ee8cd214c Mon Sep 17 00:00:00 2001 From: RayPals Date: Mon, 1 Jun 2026 00:53:42 +0200 Subject: [PATCH] Add docs/DEBUGGING.md from Claro v1.17.26 zip --- docs/DEBUGGING.md | 52 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 docs/DEBUGGING.md diff --git a/docs/DEBUGGING.md b/docs/DEBUGGING.md new file mode 100644 index 0000000..89e3723 --- /dev/null +++ b/docs/DEBUGGING.md @@ -0,0 +1,52 @@ +# Debugging Claro Programs + +## 1) Runtime errors (OOPS screen) + +When Claro hits a runtime error, it prints a message like: + +``` +*** OOPS! *** +main.claro:12: Division by zero +Stack trace: + at updateScore (game.claro:44) + at main (main.claro:12) +``` + +### What it means +- `file:line:` is where the error happened. +- The stack trace lists the most recent function calls. + +## 2) TRY / CATCH + +Errors inside TRY jump to CATCH: + +```claro +TRY + CALL mightFail WITH 1 +CATCH + SAY LASTERROR + SAY LASTERRORFILE + SAY LASTERRORLINE +ENDTRY +``` + +## 3) Static checks + +Use: +```bash +claro check yourfile.claro +``` + +This catches: +- missing ENDIF/DONE/LEARNED/etc. +- unknown keywords +- CALL unknown function / wrong arg counts (semantic checks) + +## 4) Formatting + +Use: +```bash +claro fmt yourfile.claro --inplace +``` + +This normalizes indentation and whitespace.