2219 lines
49 KiB
Markdown
2219 lines
49 KiB
Markdown
# TSL Agent Codegen Prompt Tests
|
||
|
||
This file defines manual prompt tests for evaluating whether an agent can read
|
||
`docs/tsl` and produce syntactically correct TSL code on the first attempt.
|
||
|
||
These are not TSL language docs. They are agent evaluation prompts. Keep grammar
|
||
facts in `docs/tsl`; keep agent test prompts here.
|
||
|
||
## How To Run
|
||
|
||
For each case:
|
||
|
||
1. Start from a fresh agent context that has access to this repository.
|
||
2. Send only the `Prompt` text to the agent unless the test runner has a
|
||
standard system prompt.
|
||
3. Allow the agent to read `docs/tsl`.
|
||
4. Score the first complete answer only. Do not let the agent revise.
|
||
5. Record pass/fail against the `Pass criteria`.
|
||
|
||
Recommended runner setup:
|
||
|
||
```text
|
||
You are in this repository. TSL grammar and reference docs are under docs/tsl.
|
||
When asked to write TSL, read the relevant docs/tsl pages first. Do not infer
|
||
syntax from Pascal, TypeScript, JavaScript, Python, or SQL.
|
||
```
|
||
|
||
## Scoring
|
||
|
||
- `2` = first answer satisfies all pass criteria.
|
||
- `1` = mostly correct, but has one minor issue that does not change the tested
|
||
grammar point.
|
||
- `0` = wrong file model, invalid TSL syntax, invented syntax, or missed the
|
||
tested grammar point.
|
||
|
||
Track these aggregate metrics:
|
||
|
||
- Overall first-pass accuracy.
|
||
- Accuracy by topic group.
|
||
- Most common failure patterns.
|
||
- Whether failures came from not reading docs, reading the wrong docs page, or
|
||
overfitting to another language.
|
||
|
||
## Global Failure Patterns
|
||
|
||
Flag these as failures whenever they appear in generated code:
|
||
|
||
- Uses `=` for ordinary assignment instead of `:=`.
|
||
- Uses comma separators in a typed parameter list, such as
|
||
`function Add(a: integer, b: integer): integer`.
|
||
- Writes named arguments as `a = 1` instead of `a: 1`.
|
||
- Writes a `.tsl` script as only top-level reusable declarations when executable
|
||
script behavior was requested.
|
||
- Appends executable script statements after a `.tsl` function or class
|
||
declaration section.
|
||
- Writes a top-level class as `class Name ... end;` instead of
|
||
`type Name = class ... end;`.
|
||
- Uses bare class names for class functions or static fields instead of
|
||
`class(Name)`.
|
||
- Invents syntax not documented in `docs/tsl`.
|
||
|
||
## Test Cases
|
||
|
||
### TSL-001: Typed Add Function
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
请根据本仓库 docs/tsl 的语法,写一个 TSL 加法函数 Add。
|
||
要求两个参数都有整数类型,返回值也要有整数类型。
|
||
只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Basic `function` declaration.
|
||
- Typed parameters and typed return value.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `function Add(a: integer; b: integer): integer;`.
|
||
- Uses `return a + b;`.
|
||
- Uses `begin ... end;`.
|
||
- Does not separate typed parameters with commas.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-002: Executable Script Calling A Local Function
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段可执行的 .tsl 脚本:计算 1 + 2,并用 writeLn 输出结果。
|
||
加法逻辑封装成 Add 函数,脚本里调用它。
|
||
只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- `.tsl` file model.
|
||
- Executable statements before local function declarations.
|
||
|
||
Pass criteria:
|
||
|
||
- Script statements appear before the `function Add...` declaration.
|
||
- Calls `writeLn(Add(1, 2));` or an equivalent statement before declarations.
|
||
- Does not append executable statements after the function declaration.
|
||
- Uses `:=` for ordinary assignments if assignments are introduced.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/01_quickstart.md`
|
||
- `docs/tsl/syntax/02_core_model.md`
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-003: Reusable Function File
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
我要一个可复用的 .tsf 函数扩展文件,里面只有一个函数 IsPositive,
|
||
输入整数 x,返回 x 是否大于 0。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- `.tsf` reusable declaration model.
|
||
- No executable script entry statements.
|
||
|
||
Pass criteria:
|
||
|
||
- Outputs a top-level `function IsPositive(x: integer);` or typed return variant
|
||
if supported by the chosen evidence.
|
||
- Function body returns `x > 0`.
|
||
- Does not add `.tsl` entry statements such as `writeLn(...)`.
|
||
- Does not invent an undocumented `boolean` return type.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/01_quickstart.md`
|
||
- `docs/tsl/syntax/02_core_model.md`
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-004: Procedure With Write-Back Parameter
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 .tsl 脚本,定义一个过程 Bump,把传入变量加 1。
|
||
脚本里先把 a 设为 1,调用 Bump(a),再输出 a。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- `procedure` only when explicitly requested.
|
||
- `var` parameter write-back.
|
||
- `.tsl` declaration section order.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `procedure Bump(var x);`.
|
||
- Assigns `a := 1;` before calling `Bump(a);`.
|
||
- Outputs `a` before the procedure declaration section.
|
||
- Does not put a return type on the `procedure` header.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
- `docs/tsl/syntax/02_core_model.md`
|
||
|
||
### TSL-005: Named Parameter Call
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 示例,定义函数 MakePair(a, b),返回 array(a, b)。
|
||
调用时必须使用命名参数,把 b 传 20,把 a 传 10,并输出两个元素。
|
||
只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Named argument syntax.
|
||
- Array indexing.
|
||
|
||
Pass criteria:
|
||
|
||
- Calls the function with `MakePair(b: 20, a: 10)` or equivalent named argument
|
||
order.
|
||
- Does not use `MakePair(b = 20, a = 10)`.
|
||
- Reads array elements with zero-based array indexes.
|
||
- Keeps executable statements before the function declaration in `.tsl`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
- `docs/tsl/syntax/12_matrix_and_collections.md`
|
||
|
||
### TSL-006: Default Variable Model
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段最简单的 TSL 脚本:把 3 赋给 a,把 4 赋给 b,
|
||
再输出 a * b。不要做多余声明。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Ordinary variables do not need a `var` declaration by default.
|
||
- Assignment operator.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `a := 3;` and `b := 4;`.
|
||
- Does not use `a = 3;` or `b = 4;`.
|
||
- Does not add unnecessary `var` declarations.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/04_variables_and_constants.md`
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-007: Explicit Variable Mode
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,开启 explicit 模式,声明变量 total,
|
||
把 total 设置为 0,然后输出它。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- `{$explicit+}`.
|
||
- Explicit `var` declaration.
|
||
|
||
Pass criteria:
|
||
|
||
- Starts with `{$explicit+}` or places it before first undeclared variable use.
|
||
- Declares `var total;`.
|
||
- Assigns with `total := 0;`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/04_variables_and_constants.md`
|
||
- `docs/tsl/syntax/16_lexical_structure_and_compile_options.md`
|
||
|
||
### TSL-008: Constant Initialization
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,定义常量 max_count 为 3 + 4,
|
||
然后输出 max_count。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- `const name = value;` is constant initialization, not ordinary assignment.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `const max_count = 3 + 4;`.
|
||
- Outputs `max_count`.
|
||
- Does not later assign to `max_count`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/04_variables_and_constants.md`
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-009: Single-Variable Destructuring
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,从 array(7, 8, 9) 里只拆出第一个值到 first,
|
||
然后输出 first。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Single-variable destructuring keeps the trailing comma.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `[first, ] := array(7, 8, 9);`.
|
||
- Does not use `[first] := ...`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/04_variables_and_constants.md`
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-010: If Else Block
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本:如果 score >= 60,就把 result 设为 "pass",
|
||
否则设为 "fail",最后输出 result。score 设为 70。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Block-style `if ... then begin ... end else begin ... end`.
|
||
- No semicolon between `then` block `end` and `else`.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `if score >= 60 then` followed by a valid block.
|
||
- Does not put a semicolon after the `then` branch `end` before `else`.
|
||
- Outputs after the conditional block, not inside only one branch.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/07_control_flow.md`
|
||
|
||
### TSL-011: For Loop With Step
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,用 for 循环计算 1、3、5 的和并输出。
|
||
要求使用 step。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- `for i := 1 to 5 step 2 do`.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `for i := 1 to 5 step 2 do`.
|
||
- Accumulates with `:=` or `+=`.
|
||
- Outputs `9` or the computed sum variable.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/07_control_flow.md`
|
||
|
||
### TSL-012: Array Traversal
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,遍历 array(10, 20, 30),每行输出索引和值的和。
|
||
必须使用 for i, v in data。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Array traversal form.
|
||
- Zero-based index behavior.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `for i, v in data do`.
|
||
- Uses `data := array(10, 20, 30);`.
|
||
- Does not invent Python-style or JavaScript-style iteration syntax.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/07_control_flow.md`
|
||
|
||
### TSL-013: Array And String Indexing
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,创建 array(10, 20, 30) 和字符串 "ABC"。
|
||
输出数组第一个元素,再输出字符串第一个字符。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Arrays are zero-based.
|
||
- Strings are one-based.
|
||
|
||
Pass criteria:
|
||
|
||
- Reads the first array element with `arr[0]`.
|
||
- Reads the first string character with `s[1]`.
|
||
- Does not use `s[0]`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/01_quickstart.md`
|
||
- `docs/tsl/syntax/03_values_and_literals.md`
|
||
- `docs/tsl/syntax/11_pitfalls.md`
|
||
|
||
### TSL-014: Hash-Like Array
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,用 array 创建一个带字符串键的表,
|
||
包含 Code = "0001" 和 Price = 12.3,然后输出 Code。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- `array("Code": "0001", "Price": 12.3)`.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses string-key `array(...)` syntax.
|
||
- Reads with `hash["Code"]` or equivalent variable name.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/12_matrix_and_collections.md`
|
||
|
||
### TSL-015: in Versus sqlin
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,同时演示:
|
||
1 是否属于 array(1, 2),以及 array(1, 2) 这一整行是否存在于
|
||
array((1, 2), (3, 4))。分别输出两个判断结果。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Element/subset relation uses `in`.
|
||
- Whole-row relation uses `sqlin`.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `1 in array(1, 2)`.
|
||
- Uses `array(1, 2) sqlin array((1, 2), (3, 4))`.
|
||
- Does not use `in` for the whole-row test.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/12_matrix_and_collections.md`
|
||
|
||
### TSL-016: Explicit String To Integer Conversion
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,把字符串 "1234" 转成整数后加 1,
|
||
再输出结果。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Explicit conversion instead of relying on mixed-type arithmetic.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `strToInt(...)`.
|
||
- Does not directly compute `"1234" + 1`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/17_types_and_conversions.md`
|
||
|
||
### TSL-017: Nil Handling
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,创建空数组 arr,判断 arr[0] 是否为 nil,
|
||
并输出判断结果。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Empty array missing element returns `nil`.
|
||
- Explicit nil comparison.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `arr := array();`.
|
||
- Checks `arr[0] = nil` or uses documented `ifNil(...)`.
|
||
- Does not invent `null`, `None`, or `undefined`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/17_types_and_conversions.md`
|
||
|
||
### TSL-018: Regex-Like
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,判断字符串 "abc" 是否匹配以 a 开头的模式,
|
||
用 like 运算符,并输出结果。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- `like` right side is regex-like, not SQL `%` wildcard.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses a regex-style pattern such as `"^a.*"` or another documented-compatible
|
||
regex pattern.
|
||
- Does not use `"a%"` as the pattern.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
- `docs/tsl/syntax/11_pitfalls.md`
|
||
|
||
### TSL-019: Basic Class
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 .tsl 脚本,定义 Person 类,包含 public 字段 name。
|
||
脚本里创建 Person,把 name 设为 "Tom",然后输出 name。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Top-level class declaration syntax.
|
||
- `.tsl` executable statements before class declaration section.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `type Person = class`.
|
||
- Includes `public` before `name;`.
|
||
- Creates with `new Person()`.
|
||
- Does not write `class Person`.
|
||
- Does not append executable statements after the class declaration.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
- `docs/tsl/syntax/02_core_model.md`
|
||
|
||
### TSL-020: Public Constructor
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 .tsl 脚本,定义 Counter 类。
|
||
构造函数接收初始值 v,保存到 value;Inc 方法把 value 加 1 并返回。
|
||
脚本里 new Counter(10),输出 Inc 的结果。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- `function create(...)` constructor under `public`.
|
||
- Instance method body accesses members directly.
|
||
|
||
Pass criteria:
|
||
|
||
- Defines `type Counter = class`.
|
||
- Puts `function create(v);` in a `public` section.
|
||
- Uses `value := v;` in `create`.
|
||
- Uses `value := value + 1; return value;` or equivalent in `Inc`.
|
||
- Does not make `create` private or protected.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
|
||
### TSL-021: Static Field Access
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,定义 THuman 类,包含 static 字段 mCount。
|
||
先把 mCount 设置为 100,再输出它。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Static field access through class type.
|
||
|
||
Pass criteria:
|
||
|
||
- Defines `static mCount;`.
|
||
- Sets or reads it through `class(THuman).mCount`.
|
||
- Does not use `THuman.mCount`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
- `docs/tsl/syntax/11_pitfalls.md`
|
||
|
||
### TSL-022: Class Function Access
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 类 MathBox,里面有 class function Add(a, b),返回 a + b。
|
||
再写脚本输出 MathBox 的 Add(1, 2) 结果。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Class function declaration.
|
||
- Class function call through class type.
|
||
|
||
Pass criteria:
|
||
|
||
- Defines a `class function Add(a, b);` inside `type MathBox = class`.
|
||
- Calls via `class(MathBox).Add(1, 2)` or another documented class-type path.
|
||
- Does not call `MathBox.Add(1, 2)`.
|
||
- Keeps executable call before the class declaration in `.tsl`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
- `docs/tsl/syntax/11_pitfalls.md`
|
||
|
||
### TSL-023: Full Unit Skeleton
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 .tsf unit,名字是 DemoUnit。
|
||
对外暴露函数 Ping,调用返回 1。使用完整 interface / implementation 结构。
|
||
只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Full `unit` structure.
|
||
- `end.` terminator.
|
||
|
||
Pass criteria:
|
||
|
||
- Starts with `unit DemoUnit;`.
|
||
- Has `interface` and `implementation` sections.
|
||
- Declares `function Ping();` in `interface`.
|
||
- Implements `function Ping(); begin return 1; end;`.
|
||
- Ends the unit with `end.`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/09_units_and_scope.md`
|
||
- `docs/tsl/syntax/01_quickstart.md`
|
||
|
||
### TSL-024: Top-Level uses Before Statements
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 .tsl 脚本,使用 UnitA 和 UnitB 两个 unit,
|
||
然后调用 Run() 并输出结果。注意 uses 的位置。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Top-level `uses` before ordinary statements.
|
||
- Multiple units in one `uses` statement.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `uses UnitA, UnitB;` before executable statements.
|
||
- Does not write ordinary statements before top-level `uses`.
|
||
- Does not generate two separate top-level `uses` statements as the default.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/09_units_and_scope.md`
|
||
- `docs/tsl/syntax/11_pitfalls.md`
|
||
|
||
### TSL-025: Function-Body uses Placement
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 函数 RunInFunction,函数体内使用 DemoUnit,
|
||
然后返回 Ping()。只输出这个函数代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Function-body `uses` must be the first statement.
|
||
|
||
Pass criteria:
|
||
|
||
- Writes `uses DemoUnit;` as the first statement after `begin`.
|
||
- Does not put any assignment or other statement before function-body `uses`.
|
||
- Does not repeat `uses` inside the same function body.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/09_units_and_scope.md`
|
||
|
||
### TSL-026: Try Except
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,用 try/except 捕获 raise "bad",
|
||
在 except 中输出 exceptObject.errInfo。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- TSL exception syntax.
|
||
- `exceptObject` fields.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `try ... except ... end`.
|
||
- Raises with `raise "bad"`.
|
||
- Reads `exceptObject.errInfo` in the `except` block.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/07_control_flow.md`
|
||
|
||
### TSL-027: Ambiguous File Model
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
帮我写一个 TSL 的加法函数。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Handling an underspecified user request.
|
||
- Avoiding invented file model assumptions.
|
||
|
||
Pass criteria:
|
||
|
||
- Either produces only a minimal reusable function declaration, or explicitly
|
||
states the file-model assumption before the code.
|
||
- Uses `function`, not `procedure`.
|
||
- Does not generate invalid `.tsl` declaration ordering.
|
||
- Does not invent parameter types if the prompt did not require them.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/index.md`
|
||
- `docs/tsl/syntax/01_quickstart.md`
|
||
- `docs/tsl/syntax/02_core_model.md`
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-028: Bad Prompt With Type Requirement
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
帮我写一个tsl代码,写一个加法,需要参数类型和返回类型。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Robustness to informal Chinese prompts.
|
||
- Correct typed function syntax.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses a `function` with typed parameters and typed return value.
|
||
- Uses semicolons between typed parameters.
|
||
- Uses `return a + b;`.
|
||
- Does not use TypeScript-like syntax such as
|
||
`function add(a: number, b: number): number`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-029: Anti-Pascal Assignment Trap
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,把 a 设为 1,把 b 设为 2,
|
||
如果 a + b 等于 3 就输出 "ok"。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- Ordinary assignment versus equality comparison.
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `a := 1;` and `b := 2;`.
|
||
- Uses `=` only in the comparison expression.
|
||
- Does not use `==`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
- `docs/tsl/syntax/11_pitfalls.md`
|
||
|
||
### TSL-030: No Script After Declaration Trap
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 .tsl 脚本:先调用 Hello(),Hello 输出 "hello"。
|
||
调用完成后再输出 "done"。只输出代码。
|
||
```
|
||
|
||
Expected focus:
|
||
|
||
- All executable script statements must be before the declaration section.
|
||
- A natural prompt order can tempt the agent to put `writeLn("done")` after
|
||
`function Hello`.
|
||
|
||
Pass criteria:
|
||
|
||
- Places both `Hello();` and the statement that outputs `"done"` before
|
||
`function Hello();`.
|
||
- Defines `Hello` after the executable statements.
|
||
- Does not append the `"done"` output statement after the function declaration.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/01_quickstart.md`
|
||
- `docs/tsl/syntax/02_core_model.md`
|
||
- `docs/tsl/syntax/11_pitfalls.md`
|
||
|
||
## Extended Compact Cases
|
||
|
||
The first 30 cases above are detailed baseline cases. The following compact
|
||
cases broaden grammar coverage while keeping each prompt independently runnable.
|
||
|
||
### TSL-031: Numeric Literal Types
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,分别输出 0x10、0b10、0o10、100L、1E2 的类型判断结果。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented numeric literals.
|
||
- Uses type checks such as `ifInt`, `ifInt64`, and `ifReal`.
|
||
- Does not rewrite the literals into decimal-only values.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/17_types_and_conversions.md`
|
||
|
||
### TSL-032: Date Time Literals
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,创建 20111231T 和 20101231.0931T,
|
||
并分别输出日期和时间字符串。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented date-time literal forms.
|
||
- Uses documented conversion helpers such as `dateToStr` and `timeToStr`.
|
||
- Does not invent ISO string literal syntax.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/17_types_and_conversions.md`
|
||
|
||
### TSL-033: Boolean And Numeric Truthiness
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,输出 true、false,并演示 if 2、if 0、if -1 的判断结果。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `true` and `false` directly.
|
||
- Treats `0` as false and non-zero numeric values as true.
|
||
- Does not invent `True` / `False` capitalization.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/17_types_and_conversions.md`
|
||
|
||
### TSL-034: Nil Arithmetic Boundary
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,输出 ifNil(nil)、nil + 1、1 + nil,
|
||
以及 nil + nil 是否仍为 nil。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `nil`, not `null`, `None`, or `undefined`.
|
||
- Uses `ifNil(nil)` or documented `nil` comparison.
|
||
- Does not reject `nil + 1` as invalid syntax.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/17_types_and_conversions.md`
|
||
|
||
### TSL-035: Complex Number Basics
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,创建复数 4 + 3j 和 complex(5, -2),
|
||
输出第一个复数的 real、imag 和 ifComplex 判断。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `4 + 3j` or `complex(real, imag)` as documented.
|
||
- Uses `real(...)`, `imag(...)`, and `ifComplex(...)`.
|
||
- Does not invent Python object methods such as `.real`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/17_types_and_conversions.md`
|
||
|
||
### TSL-036: String Concatenation
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,把 "TS" 和 "L" 拼成 "TSL" 并输出。
|
||
使用 docs/tsl 里确认的字符串连接写法。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented string concatenation with `+` or `$`.
|
||
- Uses TSL string literals.
|
||
- Does not call undocumented helpers such as `concat(...)`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/03_values_and_literals.md`
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-037: Arithmetic Operator Coverage
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,分别输出 9 div 4、9 mod 4、2 ^ 3、8 ~ 2、3 \ 2。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `div`, `mod`, `^`, `~`, and `\` as documented.
|
||
- Does not replace them with JavaScript-style operators.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-038: Conditional Expression
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,a 小于 b 时 value 为 10,否则为 20,
|
||
要求使用条件表达式并输出 value。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `condition ? true_value : false_value`.
|
||
- Uses `:=` for assignments.
|
||
- Does not invent `?:` placement from C/JS incorrectly.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-039: Omitted-True Conditional Expression
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,分别输出 2 ?: 9 和 0 ?: 9 的结果。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses the documented `value ?: fallback` form.
|
||
- Does not rewrite it as a normal `if` statement unless it preserves the tested
|
||
expression form.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-040: Logical Operators
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,使用 and、or、not 组合两个条件,并输出结果。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `and`, `or`, and `not`.
|
||
- Does not use `!` as logical negation.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-041: Bitwise Operators
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,对两个整数演示位与、位或、位非、位异或,
|
||
并输出结果。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses dot-prefixed bitwise operators such as `.&`, `.|`, `.!`, and `.^`.
|
||
- Does not use ordinary `&`, `|`, or `~` as bitwise operators.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-042: Compound Assignment And Increment
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,a 初始为 1,先用复合赋值加 2,
|
||
再自增一次,最后输出 a。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `+=` and `a++` or `++a`.
|
||
- Initializes with `a := 1;`.
|
||
- Does not use `a = a + 2`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-043: Nil-Safe Access
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,安全读取可能为 nil 的对象成员 value,
|
||
使用 docs/tsl 里的空安全访问写法。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented nil-safe access such as `obj?.value`.
|
||
- Does not invent optional chaining forms beyond the documented patterns.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-044: Scalar Chain Comparison
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,判断 1 < 2 < 3 的连续标量比较并输出结果。
|
||
使用 docs/tsl 的链式比较写法。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses scalar chain comparison such as `1 :< 2 :< 3`.
|
||
- Does not write Python-style `1 < 2 < 3`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-045: Matrix-Like Chain Comparison
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,对 array(1, 2, -1)、array(2, 1, 0)、array(3, 2, 1)
|
||
做逐元素链式小于比较,并输出结果数组的三个元素。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses matrix chain comparison such as `::<`.
|
||
- Reads result array elements by zero-based indexes.
|
||
- Does not use scalar `:<` for array-wise comparison.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/12_matrix_and_collections.md`
|
||
- `docs/tsl/syntax/06_expressions_and_operators.md`
|
||
|
||
### TSL-046: Default Parameter
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 函数 AddOne,参数 a 默认值为 1,返回 a + 1。
|
||
再写脚本输出 AddOne() 和 AddOne(5)。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `function AddOne(a = 1);`.
|
||
- Calls the function before the `.tsl` declaration section.
|
||
- Does not use unsupported default-parameter syntax.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-047: Typed Default Parameter
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 函数 TypedAdd,参数 a 是 integer,默认值为 1,
|
||
返回值是 integer,返回 a + 1。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `function TypedAdd(a: integer = 1): integer;`.
|
||
- Does not separate typed parameters with commas.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-048: Named Parameter Skipping Middle Argument
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,定义 TestFunc(a, b, c),调用 TestFunc(1, c: 3),
|
||
在函数里输出 b 是否为 nil。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses named parameter syntax `c: 3`.
|
||
- Checks skipped `b` with `ifNil(b)` or documented nil comparison.
|
||
- Keeps executable call before the function declaration.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-049: call With Named Parameters
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,通过 call 调用 TestFunc,并用命名参数传 a、b、c。
|
||
TestFunc 返回 a * 100 + b * 10 + c。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `call("TestFunc", a: ..., b: ..., c: ...)`.
|
||
- Does not write named arguments with `=`.
|
||
- Defines `TestFunc` after the call in `.tsl`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-050: varByRef Switch
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,演示 {$varByRef-} 下未修饰参数不写回,
|
||
但 var 参数仍会写回。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `{$varByRef-}` and later restores if needed with `{$varByRef+}`.
|
||
- Includes one unmodified parameter function and one `var` parameter function.
|
||
- Does not rely on another language's value/reference model.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
- `docs/tsl/syntax/16_lexical_structure_and_compile_options.md`
|
||
|
||
### TSL-051: in And out Call Prefixes
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,在 {$varByRef-} 下调用 Touch3(in a, out b, c),
|
||
演示只有 b 被写回。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses call-site prefixes `in` and `out`.
|
||
- Uses `{$varByRef-}`.
|
||
- Does not write `in` / `out` as type annotations in the function header.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-052: exit Boundary
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,函数 Demo(x) 在 x > 0 时 exit,
|
||
否则 return 99;输出 Demo(1) 和 Demo(0)。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `exit;` inside the function.
|
||
- Uses `return 99;` for the other branch.
|
||
- Does not treat `exit` as returning an explicit custom value.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-053: Variadic Sum
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 可变参数函数 SumAll(...),遍历 Params 求和并返回。
|
||
再输出 SumAll(1, 2, 3, 4)。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `function SumAll(...);`.
|
||
- Iterates `Params`.
|
||
- Does not invent JavaScript rest syntax.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-054: ParamCount And RealParamCount
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 函数 CountArgs(a, b, ...),返回 ParamCount * 10 + RealParamCount。
|
||
输出 CountArgs(1, 2, 3, 4)。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `ParamCount` and `RealParamCount`.
|
||
- Uses trailing `...` in the function header.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-055: Variadic Forward With call
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,DoFunc(fc, ...) 通过 call(fc, ...) 转发参数给 Sum3。
|
||
输出 DoFunc("Sum3", 1, 2, 3)。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `call(fc, ...)`.
|
||
- Uses `function DoFunc(fc, ...);`.
|
||
- Does not manually unpack a fixed number of variadic arguments.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-056: Anonymous Function Variable
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,把匿名函数赋给变量 a,
|
||
匿名函数返回 x + y,然后用 call(a, 1, 2) 输出结果。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `a := function(x, y) begin ... end;`.
|
||
- Calls via `call(a, 1, 2)` or documented `##a(...)`.
|
||
- Does not call the function variable only as `a(1, 2)`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-057: Anonymous Function As Argument
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,定义 Apply(fun),内部 call(fun, 2, 3)。
|
||
调用 Apply 时直接传入一个匿名乘法函数。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Passes `function(x, y) begin ... end` as an argument.
|
||
- Uses `call(fun, 2, 3)` inside `Apply`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-058: findFunction Call
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,用 findFunction("Add") 找到 Add 函数,
|
||
再用文档支持的函数值调用方式输出 Add(1, 2)。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `findFunction("Add")`.
|
||
- Calls the returned function with `##f(...)` or `call(f, ...)`.
|
||
- Does not call `f(...)` directly.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-059: thisFunction Call
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,用 thisFunction(Add) 得到函数值,
|
||
再通过一个 Call 包装函数调用它。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `thisFunction(Add)`.
|
||
- Calls the function value with `call(...)` or documented wrapper style.
|
||
- Does not quote `Add` if using `thisFunction`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-060: Global Function Qualification
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,局部函数名和全局/系统函数同名时,
|
||
用 docs/tsl 里明确的全局函数限定调用写法。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `::FuncName(...)` for global/system function qualification.
|
||
- Does not invent namespace separators from other languages.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/05_functions_and_calls.md`
|
||
|
||
### TSL-061: Case Statement With Range
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,a 为 4,用 case 判断:
|
||
1,2 输出 small;3 到 5 输出 mid;其他输出 other。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `case a of`.
|
||
- Uses comma labels and `3 to 5`.
|
||
- Uses `else` and closes with `end`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/07_control_flow.md`
|
||
|
||
### TSL-062: Case Expression
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,用 case 表达式给 value 赋值,
|
||
a 为 2 时 value 是 "two",否则是 "other",然后输出 value。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `value := case ... of ... else ... end;`.
|
||
- Does not put `begin ... end` blocks inside expression-form branches.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/07_control_flow.md`
|
||
|
||
### TSL-063: Repeat Until
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,用 repeat ... until 把 counter 从 3 减到 0,
|
||
最后输出 counter。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `repeat ... until counter = 0;`.
|
||
- Does not write `do while` syntax.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/07_control_flow.md`
|
||
|
||
### TSL-064: Break In While Loop
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,用 while true 循环累加 1 到 3,
|
||
i 大于 3 时 break,然后输出 sum。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `while true do`.
|
||
- Uses `break;` inside the loop.
|
||
- Uses TSL block structure for multi-statement loop body.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/07_control_flow.md`
|
||
|
||
### TSL-065: Continue In While Loop
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,while 循环 i 从 1 到 4,
|
||
跳过 i = 2,只累加其他值并输出 sum。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `continue;` for the skipped iteration.
|
||
- Does not put the increment after a `continue` path that would cause an
|
||
infinite loop.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/07_control_flow.md`
|
||
|
||
### TSL-066: Try Finally
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,用 try/finally,try 中输出 "run",
|
||
finally 中输出 "cleanup"。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `try ... finally ... end`.
|
||
- Does not use `catch` or JavaScript-style exception syntax.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/07_control_flow.md`
|
||
|
||
### TSL-067: Exception Metadata
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,raise "bad" 后在 except 中输出 errInfo、errLine、errNo。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `exceptObject.errInfo`, `exceptObject.errLine`, and `exceptObject.errNo`.
|
||
- Uses `try ... except ... end`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/07_control_flow.md`
|
||
|
||
### TSL-068: Nested Array Destructuring
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,从 array((1, 2), (3, 4)) 拆出 r1 和 r2,
|
||
并输出 r1[0]、r1[1]、r2[0]、r2[1]。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `[r1, r2] := array((1, 2), (3, 4));`.
|
||
- Reads nested array elements with zero-based indexes.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/04_variables_and_constants.md`
|
||
- `docs/tsl/syntax/12_matrix_and_collections.md`
|
||
|
||
### TSL-069: Row Set Operations
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 脚本,对 left_rows 和 right_rows 做 union2、intersect、minus、outersect。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses row-set operators `union2`, `intersect`, `minus`, and `outersect`.
|
||
- Does not treat `union2` as preserving duplicate rows.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/12_matrix_and_collections.md`
|
||
|
||
### TSL-070: filterIn Single Column
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,用 filterIn 按单列从结果集中筛选命中行。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `filterIn(...)` shape.
|
||
- Does not replace resultset filtering with `in`/`sqlin` set operations.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/13_resultset_and_filters.md`
|
||
|
||
### TSL-071: filterNotIn
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,用 filterNotIn 从结果集中排除命中行。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `filterNotIn(...)` shape.
|
||
- Does not use `minus` when the task asks to preserve filtering semantics.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/13_resultset_and_filters.md`
|
||
|
||
### TSL-072: TS-SQL Minimal Query
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,对 array((1, 2), (3, 4)) 使用 TS-SQL 最小查询骨架。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented TS-SQL query form from the syntax docs.
|
||
- Does not invent ordinary SQL string execution.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/14_ts_sql.md`
|
||
|
||
### TSL-073: TS-SQL where And order by
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,使用 TS-SQL 对数组结果集按条件过滤并排序。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `where` and `order by` TS-SQL syntax.
|
||
- Does not use SQL `%` wildcard assumptions unless documented for TS-SQL.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/14_ts_sql.md`
|
||
|
||
### TSL-074: TS-SQL group by
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,使用 TS-SQL 按字段 group by,并计算每组统计值。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `group by` TS-SQL form.
|
||
- Uses documented aggregate/reference helpers only.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/14_ts_sql.md`
|
||
|
||
### TSL-075: TS-SQL join
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,用 TS-SQL join 两个数组结果集。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `join` form.
|
||
- Does not invent database connection or external SQL execution.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/14_ts_sql.md`
|
||
|
||
### TSL-076: Runtime with Star
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,使用 docs/tsl 中的 with * 块环境写法。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `with *` syntax.
|
||
- Does not invent Python `with` semantics.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/10_runtime_context_and_with.md`
|
||
|
||
### TSL-077: Runtime with Double Star
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,使用 docs/tsl 中的 with ** 块环境写法。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `with **` syntax.
|
||
- Does not generalize beyond the documented runtime context form.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/10_runtime_context_and_with.md`
|
||
|
||
### TSL-078: Grid Call Timeout
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,用 # 网格调用并带 timeout。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `#Func(...)` and `timeout N` shape.
|
||
- Does not turn `timeout` into a normal function argument unless documented.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/10_runtime_context_and_with.md`
|
||
|
||
### TSL-079: Global Cache
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,设置全局缓存、读取全局缓存,并判断缓存是否存在。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `setGlobalCache`, `getGlobalCache`, and `ifCache`.
|
||
- Does not invent browser/local-storage style APIs.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/10_runtime_context_and_with.md`
|
||
|
||
### TSL-080: Conditional Compilation
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,使用 {$ifdef ...} 和 {$else} 做条件编译分支。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented compile-option syntax.
|
||
- Does not write runtime `if` when the task asks for conditional compilation.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/16_lexical_structure_and_compile_options.md`
|
||
|
||
### TSL-081: Comments And Identifiers
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,包含 docs/tsl 支持的注释写法和一个普通标识符赋值。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented comment syntax from the lexical structure page.
|
||
- Uses `:=` for assignment.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/16_lexical_structure_and_compile_options.md`
|
||
|
||
### TSL-082: goto Label
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,使用 goto 跳转到标签并输出结果。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `goto` and label syntax.
|
||
- Does not invent C-style label rules if they differ from docs.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/15_debug_and_profiler.md`
|
||
|
||
### TSL-083: debugReturn
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,使用 debugReturn 提前返回调试值。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `debugReturn` form.
|
||
- Does not confuse it with ordinary `return` unless both are required.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/15_debug_and_profiler.md`
|
||
|
||
### TSL-084: Profiler Timing
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,使用 mtic 和 mtoc 做简单计时。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `mtic` / `mtoc` shape.
|
||
- Does not invent external timing APIs.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/15_debug_and_profiler.md`
|
||
|
||
### TSL-085: External Function Declaration
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL external 函数声明示例,按 docs/tsl 的最小 external 写法。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `external` declaration shape.
|
||
- Does not invent FFI syntax from C, Python, or TypeScript.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/18_external_calls_and_threads.md`
|
||
|
||
### TSL-086: External Procedure Declaration
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL procedure external 示例。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `procedure external` shape.
|
||
- Does not put a return type on the procedure header.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/18_external_calls_and_threads.md`
|
||
|
||
### TSL-087: Native Function Pointer Wrapper
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,按 docs/tsl 包装原生函数指针。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses only the documented native-function-pointer wrapper shape.
|
||
- Does not invent raw pointer syntax.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/18_external_calls_and_threads.md`
|
||
|
||
### TSL-088: Thread Minimal Pattern
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 线程模式最小正例,按 docs/tsl 的线程示例组织。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented thread-mode syntax.
|
||
- Does not invent async/await or JavaScript thread syntax.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/18_external_calls_and_threads.md`
|
||
|
||
### TSL-089: Class Property
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 类 Box,字段 value 通过 property Value read/write 访问。
|
||
脚本里设置并输出这个属性。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `property Name read ... write ...` shape.
|
||
- Uses `type Box = class`.
|
||
- Creates with `new Box()`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
|
||
### TSL-090: Typed Class Property
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 类 Person,包含 string 类型字段 name_,
|
||
并定义带类型注解的 property Name。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses field type annotation such as `name_: string;`.
|
||
- Uses documented typed property form.
|
||
- Does not invent C# property blocks.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
|
||
### TSL-091: Method Overload
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 类 Calc,包含两个同名 Add 方法,参数个数不同。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `overload` method form.
|
||
- Keeps methods inside `type Calc = class`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
|
||
### TSL-092: Inheritance
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 类 Animal 和继承它的 Dog,Dog 增加一个方法 Speak。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `type Dog = class(Animal)`.
|
||
- Does not use `extends`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
|
||
### TSL-093: Virtual Override
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 父类 Base,虚方法 Name;子类 Child 覆盖 Name。
|
||
脚本里创建 Child 并输出 Name。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `virtual` and `override`.
|
||
- Uses `type Child = class(Base)`.
|
||
- Creates with `new Child()`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
|
||
### TSL-094: Inherited Method Call
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 子类方法,在方法里调用父类同名方法后再追加自己的逻辑。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `Inherited` call form.
|
||
- Does not invent `super.method()` syntax.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
|
||
### TSL-095: Class Method Implementation Outside Class
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 类 Greeter,类内只声明 Say 方法,
|
||
在类外用 ClassName.Method 形式实现它。只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses class declaration plus `function Greeter.Say(...)` implementation.
|
||
- Does not append executable script statements after the implementation section.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
|
||
### TSL-096: createObject By String Class Name
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,用字符串类名通过 createObject 创建本地类实例。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `createObject("ClassName")` shape.
|
||
- Uses `new ClassName()` only if explaining it is not the requested string-name
|
||
path.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
|
||
### TSL-097: Destructor
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 类,定义无参 destroy 函数,在对象引用设为 nil 时触发清理。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses `function destroy();`.
|
||
- Sets the object reference to `nil` in executable script code.
|
||
- Does not invent `destructor` keyword.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/08_objects_and_classes.md`
|
||
|
||
### TSL-098: FMArray Basics
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,创建 FMArray,判断它是 FMArray,并输出尺寸信息。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented FMArray construction from the FMArray page.
|
||
- Uses documented FMArray type/size helpers.
|
||
- Does not treat plain `array(...)` as automatically being FMArray.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/23_fmarray.md`
|
||
|
||
### TSL-099: Matrix Deep Dive
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一段 TSL 示例,初始化矩阵并使用 mrows、mcols、msize 输出维度。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented matrix initialization.
|
||
- Uses `mrows`, `mcols`, and `msize`.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/22_matrix_deep_dive.md`
|
||
|
||
### TSL-100: Object Operator Overload
|
||
|
||
Prompt:
|
||
|
||
```text
|
||
写一个 TSL 类,重载二元 + 运算符,让两个对象相加得到一个新对象。
|
||
只输出代码。
|
||
```
|
||
|
||
Pass criteria:
|
||
|
||
- Uses documented `operator +` overload shape.
|
||
- Keeps overload implementation inside a valid `type Name = class` structure.
|
||
- Does not invent Python `__add__` or C++ syntax.
|
||
|
||
Source docs:
|
||
|
||
- `docs/tsl/syntax/24_object_overloads_and_iteration.md`
|
||
|
||
## Result Sheet Template
|
||
|
||
Copy this table for each evaluated agent:
|
||
|
||
| Case | Score | Failure pattern | Notes |
|
||
| ------- | ----: | --------------- | ----- |
|
||
| TSL-001 | | | |
|
||
| TSL-002 | | | |
|
||
| TSL-003 | | | |
|
||
| TSL-004 | | | |
|
||
| TSL-005 | | | |
|
||
| TSL-006 | | | |
|
||
| TSL-007 | | | |
|
||
| TSL-008 | | | |
|
||
| TSL-009 | | | |
|
||
| TSL-010 | | | |
|
||
| TSL-011 | | | |
|
||
| TSL-012 | | | |
|
||
| TSL-013 | | | |
|
||
| TSL-014 | | | |
|
||
| TSL-015 | | | |
|
||
| TSL-016 | | | |
|
||
| TSL-017 | | | |
|
||
| TSL-018 | | | |
|
||
| TSL-019 | | | |
|
||
| TSL-020 | | | |
|
||
| TSL-021 | | | |
|
||
| TSL-022 | | | |
|
||
| TSL-023 | | | |
|
||
| TSL-024 | | | |
|
||
| TSL-025 | | | |
|
||
| TSL-026 | | | |
|
||
| TSL-027 | | | |
|
||
| TSL-028 | | | |
|
||
| TSL-029 | | | |
|
||
| TSL-030 | | | |
|
||
| TSL-031 | | | |
|
||
| TSL-032 | | | |
|
||
| TSL-033 | | | |
|
||
| TSL-034 | | | |
|
||
| TSL-035 | | | |
|
||
| TSL-036 | | | |
|
||
| TSL-037 | | | |
|
||
| TSL-038 | | | |
|
||
| TSL-039 | | | |
|
||
| TSL-040 | | | |
|
||
| TSL-041 | | | |
|
||
| TSL-042 | | | |
|
||
| TSL-043 | | | |
|
||
| TSL-044 | | | |
|
||
| TSL-045 | | | |
|
||
| TSL-046 | | | |
|
||
| TSL-047 | | | |
|
||
| TSL-048 | | | |
|
||
| TSL-049 | | | |
|
||
| TSL-050 | | | |
|
||
| TSL-051 | | | |
|
||
| TSL-052 | | | |
|
||
| TSL-053 | | | |
|
||
| TSL-054 | | | |
|
||
| TSL-055 | | | |
|
||
| TSL-056 | | | |
|
||
| TSL-057 | | | |
|
||
| TSL-058 | | | |
|
||
| TSL-059 | | | |
|
||
| TSL-060 | | | |
|
||
| TSL-061 | | | |
|
||
| TSL-062 | | | |
|
||
| TSL-063 | | | |
|
||
| TSL-064 | | | |
|
||
| TSL-065 | | | |
|
||
| TSL-066 | | | |
|
||
| TSL-067 | | | |
|
||
| TSL-068 | | | |
|
||
| TSL-069 | | | |
|
||
| TSL-070 | | | |
|
||
| TSL-071 | | | |
|
||
| TSL-072 | | | |
|
||
| TSL-073 | | | |
|
||
| TSL-074 | | | |
|
||
| TSL-075 | | | |
|
||
| TSL-076 | | | |
|
||
| TSL-077 | | | |
|
||
| TSL-078 | | | |
|
||
| TSL-079 | | | |
|
||
| TSL-080 | | | |
|
||
| TSL-081 | | | |
|
||
| TSL-082 | | | |
|
||
| TSL-083 | | | |
|
||
| TSL-084 | | | |
|
||
| TSL-085 | | | |
|
||
| TSL-086 | | | |
|
||
| TSL-087 | | | |
|
||
| TSL-088 | | | |
|
||
| TSL-089 | | | |
|
||
| TSL-090 | | | |
|
||
| TSL-091 | | | |
|
||
| TSL-092 | | | |
|
||
| TSL-093 | | | |
|
||
| TSL-094 | | | |
|
||
| TSL-095 | | | |
|
||
| TSL-096 | | | |
|
||
| TSL-097 | | | |
|
||
| TSL-098 | | | |
|
||
| TSL-099 | | | |
|
||
| TSL-100 | | | |
|