fix: harden Claro diagnostics and runtime guards

Preserve source locations, validate malformed JSON, and add opt-in resource limits. Include executable error-guide coverage, learner pilot materials, native Windows acceptance helpers, and updated CI/documentation.
This commit is contained in:
Hermes Agent
2026-10-25 02:42:53 +00:00
parent bf230f354e
commit ed23524817
42 changed files with 1128 additions and 176 deletions
+56
View File
@@ -0,0 +1,56 @@
[
{
"name": "quote",
"filename": "quote.claro",
"mode": "run",
"code": "SAY \"Start\"\nSAY \"unfinished\n",
"diagnostic": "quote.claro:2: Text is missing a closing quote. Add a double quote at the end.",
"repair": "SAY \"Start\"\nSAY \"finished\"\n",
"output": "Start\nfinished\n"
},
{
"name": "operand",
"filename": "operand.claro",
"mode": "run",
"code": "SET score 1\nSAY score +\n",
"diagnostic": "operand.claro:2: This expression needs a value after the operator.",
"repair": "SET score 1\nSAY score + 1\n",
"output": "2\n"
},
{
"name": "command",
"filename": "command.claro",
"mode": "check",
"code": "PRNT \"Hello\"\n",
"diagnostic": "command.claro:1: I do not know the command \"PRNT\". Did you mean \"SAY\"?",
"repair": "SAY \"Hello\"\n",
"output": "Hello\n"
},
{
"name": "assignment",
"filename": "assignment.claro",
"mode": "check",
"code": "SET name\n",
"diagnostic": "assignment.claro:1: SET needs a name and a value. Try: SET name \"Alex\"",
"repair": "SET name \"Alex\"\nSAY name\n",
"output": "Alex\n"
},
{
"name": "choice",
"filename": "choice.claro",
"mode": "check",
"code": "IF YES\n SAY \"Yes\"\n",
"diagnostic": "choice.claro:1: IF block opened here needs END",
"repair": "IF YES\n SAY \"Yes\"\nEND\n",
"output": "Yes\n"
},
{
"name": "variable",
"filename": "variable.claro",
"mode": "run",
"code": "SET score 10\nSAY socre\n",
"diagnostic": "variable.claro:2: I do not know the variable \"socre\" yet.",
"repair": "SET score 10\nSAY score\n",
"output": "10\n"
}
]
+44
View File
@@ -0,0 +1,44 @@
[
{
"name": "Say hello",
"code": "SAY \"Hello!\"\n",
"input": "",
"output": "Hello!\n",
"task": "Run this once. Change the message to something you choose and run it again."
},
{
"name": "Ask a name",
"code": "ASK \"Name? \" name\nSAY \"Hello \" + name\n",
"input": "Sam\n",
"output": "Name? \nHello Sam\n",
"task": "Run it and type a pretend name. Explain where that name is remembered."
},
{
"name": "Change a number",
"code": "SET score 2\nSAY score + 1\n",
"input": "",
"output": "3\n",
"task": "Predict the result, run it, then change 2 to another small number."
},
{
"name": "Make a choice",
"code": "SET score 2\nIF score > 1\n SAY \"More than one\"\nELSE\n SAY \"One or less\"\nEND\n",
"input": "",
"output": "More than one\n",
"task": "Optional: change score to 0. Predict which message appears."
},
{
"name": "Repeat",
"code": "DO 3 TIMES\n SAY \"Again\"\nEND\n",
"input": "",
"output": "Again\nAgain\nAgain\n",
"task": "Optional: change how many times the message appears. Ask how to stop a stuck run."
},
{
"name": "Save a file",
"code": "WRITE FILE \"practice.txt\" WITH \"My first file\"\nREAD FILE \"practice.txt\" AS text\nSAY text\n",
"input": "",
"output": "My first file\n",
"task": "Optional: use a new writable practice folder. Find the file after running it."
}
]