refactor: keep Claro in one strict C89 source file
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
# Contributing to Claro
|
||||
|
||||
Claro is a learning tool first. Read [`docs/LEARNING_FIRST.md`](docs/LEARNING_FIRST.md)
|
||||
before proposing learner-facing changes. Keep each change small and predictable,
|
||||
teach one recommended syntax per concept, preserve supported compatibility
|
||||
syntax, and prioritize runnable examples and plain-language diagnostics over
|
||||
feature breadth. Do not claim accessibility validation without testing with
|
||||
intended learners.
|
||||
|
||||
For behavior changes, add a focused regression before implementation and verify
|
||||
that it fails for the intended reason. Then build and run the affected examples
|
||||
and the repository validation gates. See [`docs/ROADMAP.md`](docs/ROADMAP.md) for
|
||||
how the current charter relates to older planning documents.
|
||||
|
||||
## Repository layout
|
||||
|
||||
- `src/claro.c` — C89 interpreter.
|
||||
- `lessons/` — ordered beginner lessons.
|
||||
- `examples/` — programs to try and change.
|
||||
- `docs/` — learning guides, reference, and historical notes.
|
||||
- `tests/` — regression fixtures and expected output.
|
||||
- `tools/` — validation and release helpers.
|
||||
- `lib/` — existing library helpers.
|
||||
- `support/` — optional editor support.
|
||||
|
||||
## Build and verify
|
||||
|
||||
At the beginning of a development/release run, stamp its UTC version once:
|
||||
|
||||
```bash
|
||||
python3 tools/stamp_version.py
|
||||
make -s all
|
||||
```
|
||||
|
||||
Ordinary rebuilds use `make -s all` without changing the run timestamp.
|
||||
Validation helpers also require Python 3. Run:
|
||||
|
||||
```bash
|
||||
./claro test
|
||||
./claro doctor
|
||||
./claro validate
|
||||
python3 tools/validate_v1_17.py
|
||||
```
|
||||
|
||||
The last command is the current full validation entry point; its filename is
|
||||
historical. Use focused sanitizer checks for relevant C runtime changes and
|
||||
report known failures explicitly.
|
||||
|
||||
Execute teaching examples with suitable input and assert their expected output;
|
||||
syntax checking alone is not enough. Update the relevant guide, rerun checks
|
||||
after the final edit, and finish with `git diff --check`. Preserve unrelated
|
||||
local work; exclude generated binaries, caches, and unverified experiments
|
||||
from commits. See [versioning](docs/VERSIONING.md) for the timestamp convention.
|
||||
|
||||
|
||||
The runtime must remain a single C89 implementation file. The full gate runs
|
||||
`python3 tools/validate_c89.py` to compile it independently with strict C89 flags
|
||||
and test formatting, numeric boundaries, and simple functions. Do not introduce
|
||||
C99 syntax or depend on generated project headers. See [C89 notes](docs/C89.md).
|
||||
@@ -1,5 +1,5 @@
|
||||
CC = gcc
|
||||
CFLAGS = -std=c99 -O0
|
||||
CFLAGS = -std=c89 -pedantic-errors -Werror=implicit-function-declaration -O0
|
||||
LDFLAGS = -lm
|
||||
|
||||
all: claro claro.exe
|
||||
|
||||
@@ -2,311 +2,67 @@
|
||||
|
||||
<img src="assets/Claro_Logo.jpg" alt="Claro logo" width="160">
|
||||
|
||||
**Claro** is a small, readable scripting language for beginners. It is designed to make programming approachable without requiring punctuation-heavy syntax, while still providing a path toward functions, types, objects, files, packages, and networking.
|
||||
**A learning tool first. A programming language second.**
|
||||
|
||||
Current release: **v2026.10.20.155641**
|
||||
Claro helps beginners learn programming through readable commands, simple rules,
|
||||
and small programs. Accessibility for people with learning disabilities is a
|
||||
core design goal; it still needs testing with learners.
|
||||
|
||||
## Versioning
|
||||
Current release: **v2026.10.20.160950**
|
||||
|
||||
Development/release runs use their current UTC date and time: `vYYYY.MM.DD.HHMMSS`.
|
||||
Stamp once at the beginning of each run, then build:
|
||||
## Start here
|
||||
|
||||
```bash
|
||||
python3 tools/stamp_version.py
|
||||
make
|
||||
```
|
||||
1. [Build and run Claro](docs/QUICK_START.md).
|
||||
2. [Try your first programs](docs/FIRST_HOUR.md).
|
||||
3. [Follow the ten lessons](lessons/README.md), one at a time.
|
||||
|
||||
Ordinary rebuilds retain the run version. The stamp updates current runtime,
|
||||
IDE metadata, generated project/lockfile versions, validators, and current docs;
|
||||
historical release records remain unchanged. Existing lockfiles from a previous
|
||||
run can be refreshed with `claro package lock`.
|
||||
|
||||
## Quick start
|
||||
|
||||
Claro's learning-first development charter and current priorities are in
|
||||
[`docs/LEARNING_FIRST.md`](docs/LEARNING_FIRST.md). It supersedes older
|
||||
feature-expansion priorities for current development; historical roadmaps remain
|
||||
available as project history.
|
||||
|
||||
Build Claro with a C99 compiler and `make`:
|
||||
Build with a C89 compiler and `make`, then run the first lesson:
|
||||
|
||||
```bash
|
||||
make
|
||||
```
|
||||
|
||||
Run a script:
|
||||
|
||||
```bash
|
||||
./claro lessons/01_hello.claro
|
||||
./claro examples/quiz.claro
|
||||
```
|
||||
|
||||
Check a script without running it:
|
||||
On Windows, see the [quick start](docs/QUICK_START.md) for build instructions.
|
||||
|
||||
```bash
|
||||
./claro check examples/quiz.claro
|
||||
```
|
||||
|
||||
Run the built-in test suite and validation checks:
|
||||
|
||||
```bash
|
||||
./claro test
|
||||
./claro validate
|
||||
```
|
||||
|
||||
Useful commands:
|
||||
|
||||
```text
|
||||
claro help
|
||||
claro --version
|
||||
claro doctor
|
||||
claro examples
|
||||
claro repl
|
||||
claro new MyProject
|
||||
claro run
|
||||
claro fmt file.claro
|
||||
claro typecheck file.claro
|
||||
```
|
||||
|
||||
## First Claro program
|
||||
## Your first program
|
||||
|
||||
```claro
|
||||
SAY "Hello from Claro!"
|
||||
|
||||
SAY "Hello!"
|
||||
ASK "What is your name?" name
|
||||
SAY "Hello " + name
|
||||
```
|
||||
|
||||
Claro accepts both the short beginner-friendly form and older compatibility forms. For example, these are both valid:
|
||||
Start with input/output, variables, basic math, decisions, loops, lists,
|
||||
simple functions, and saving text. You do not need classes, packages,
|
||||
networking, or advanced types to learn with Claro.
|
||||
|
||||
```claro
|
||||
SET name "Jon"
|
||||
SET name TO "Jon"
|
||||
```
|
||||
## Find your way
|
||||
|
||||
## Core language features
|
||||
- `lessons/` — small, ordered lessons.
|
||||
- `examples/` — programs to try and change.
|
||||
- [Documentation](docs/README.md) — learning guides and reference.
|
||||
- [Current roadmap](docs/ROADMAP.md) — the small set of active priorities.
|
||||
- [Learning-first rules](docs/LEARNING_FIRST.md) — how Claro is designed.
|
||||
- [Contributing](CONTRIBUTING.md) — source layout, builds, and validation.
|
||||
|
||||
### Decisions and loops
|
||||
Existing features and compatibility syntax remain supported; they are not
|
||||
required for the beginner path. Experimental features are described in the
|
||||
[detailed status](docs/CURRENT_STATUS.md), not promised as ready.
|
||||
|
||||
```claro
|
||||
SET score 10
|
||||
Claro scripts run with your permissions. Run only scripts you trust.
|
||||
|
||||
IF score >= 5
|
||||
SAY "Good job!"
|
||||
ELSE
|
||||
SAY "Try again."
|
||||
END
|
||||
## Single-file C89 interpreter
|
||||
|
||||
DO 3 TIMES
|
||||
SAY "Practice"
|
||||
DONE
|
||||
```
|
||||
|
||||
### Lists and maps
|
||||
|
||||
```claro
|
||||
SET names AS LIST OF TEXT TO LIST
|
||||
ADD "Ada" TO names
|
||||
ADD "Grace" TO names
|
||||
|
||||
FOR EACH name IN names
|
||||
SAY name
|
||||
DONE
|
||||
```
|
||||
|
||||
### Functions
|
||||
|
||||
```claro
|
||||
TEACH greet name
|
||||
SAY "Hello " + name
|
||||
END
|
||||
|
||||
DO greet "Jon"
|
||||
```
|
||||
|
||||
The older compatibility syntax remains supported:
|
||||
|
||||
```claro
|
||||
TEACH greet TAKES name
|
||||
RETURN "Hello " + name
|
||||
LEARNED
|
||||
|
||||
CALL greet WITH "Jon"
|
||||
SAY RESULT
|
||||
```
|
||||
|
||||
### Objects and classes
|
||||
|
||||
```claro
|
||||
CLASS Player
|
||||
HAS name TEXT
|
||||
HAS score NUMBER
|
||||
|
||||
TEACH add points
|
||||
SET score score + points
|
||||
END
|
||||
END
|
||||
|
||||
NEW Player player
|
||||
SET player.name "Jon"
|
||||
SET player.score 10
|
||||
DO player.add 5
|
||||
SAY player.score
|
||||
```
|
||||
|
||||
### Type checking
|
||||
|
||||
Type annotations are optional for beginners:
|
||||
|
||||
```claro
|
||||
SET score NUMBER 10
|
||||
SET name TEXT "Jon"
|
||||
SET ready YESNO YES
|
||||
CHECK TYPE score IS NUMBER
|
||||
```
|
||||
|
||||
Run static checks with:
|
||||
The complete runtime is in [`src/claro.c`](src/claro.c). Build it directly:
|
||||
|
||||
```bash
|
||||
./claro typecheck examples/type_hardening.claro
|
||||
gcc -std=c89 -pedantic-errors src/claro.c -o claro -lm
|
||||
```
|
||||
|
||||
Claro provides learner-facing diagnostics for many incorrect variable, function, method, and object-field types. For an explicitly typed object field, the separated form needs both `AS TYPE TO value`, so `SET player.score AS NUMBER` explains how to add `TO` and a value. Type checking is still a focused foundation rather than a complete static type system.
|
||||
|
||||
## Files, JSON, and standard helpers
|
||||
|
||||
Claro includes commands and libraries for practical scripts:
|
||||
|
||||
```claro
|
||||
WRITE FILE "note.txt" WITH "Hello from Claro"
|
||||
READ FILE "note.txt" AS note
|
||||
SAY note
|
||||
```
|
||||
|
||||
Standard-library modules include path and collection helpers:
|
||||
|
||||
```claro
|
||||
IMPORT "lib/path.claro" AS path
|
||||
CALL path.join WITH "notes", "today.txt"
|
||||
SAY RESULT
|
||||
```
|
||||
|
||||
See `docs/STDLIB.md` for the current helper API.
|
||||
|
||||
## Projects and packages
|
||||
|
||||
Create a project:
|
||||
|
||||
```bash
|
||||
claro new MyProject
|
||||
cd MyProject
|
||||
claro run
|
||||
```
|
||||
|
||||
Manage local project packages:
|
||||
|
||||
```bash
|
||||
claro package init
|
||||
claro package add text
|
||||
claro package list
|
||||
claro package doctor
|
||||
claro package lock
|
||||
```
|
||||
|
||||
Project metadata is stored in:
|
||||
|
||||
```text
|
||||
claro.project
|
||||
claro.lock
|
||||
packages/
|
||||
```
|
||||
|
||||
The current package system is local and foundational. Remote registries, publishing, version constraints, and package signature verification are not yet stable features.
|
||||
|
||||
## Networking
|
||||
|
||||
Claro supports beginner-oriented HTTP commands and offline `claro://` test URLs:
|
||||
|
||||
```claro
|
||||
HTTP GET "claro://hello" AS page STATUS status
|
||||
SAY page
|
||||
SAY status
|
||||
```
|
||||
|
||||
Real HTTP and HTTPS requests use `curl` when available. The offline URLs make networking lessons and tests deterministic.
|
||||
|
||||
## Current status
|
||||
|
||||
### Stable foundation
|
||||
|
||||
- Variables, output, input, expressions, and control flow
|
||||
- Loops, lists, maps, text, JSON, and file operations
|
||||
- Functions and compatibility syntax
|
||||
- Friendly errors and script checking
|
||||
- Path and collection helpers
|
||||
- Offline networking examples
|
||||
|
||||
### Foundation present
|
||||
|
||||
- Static type checking
|
||||
- Objects and classes
|
||||
- Local projects and packages
|
||||
- Networking beyond the offline test layer
|
||||
- Cooperative tasks/concurrency helpers
|
||||
- IDE metadata and completion helpers
|
||||
|
||||
These areas work in focused scenarios but still need broader coverage and polish.
|
||||
|
||||
### Experimental or planned
|
||||
|
||||
- Real SDL graphics and game-oriented graphics support
|
||||
- Web-server syntax and routes
|
||||
- Remote package registry
|
||||
- Full editor extension/LSP support
|
||||
- A complete concurrency scheduler
|
||||
|
||||
Do not treat experimental graphics as a stable cross-platform game runtime yet.
|
||||
|
||||
## Documentation map
|
||||
|
||||
Recommended reading order for new learners:
|
||||
|
||||
1. `docs/QUICK_START.md`
|
||||
2. `docs/FIRST_HOUR.md`
|
||||
3. `lessons/README.md`
|
||||
4. `docs/CLI.md`
|
||||
5. `docs/SPEC.md`
|
||||
6. `docs/CURRENT_STATUS.md`
|
||||
|
||||
Useful references:
|
||||
|
||||
- `docs/ERRORS.md` — friendly diagnostics
|
||||
- `docs/SIMPLE_FUNCTIONS.md` — function syntax
|
||||
- `docs/STDLIB.md` — standard helpers
|
||||
- `docs/TESTING.md` — test and validation workflow
|
||||
- `docs/FORMATTER.md` — formatting scripts
|
||||
- `docs/IDE.md` — editor metadata and helper support
|
||||
- `docs/ROADMAP.md` — current development direction
|
||||
|
||||
Historical release notes are kept under `docs/RC*_*.md` and older `docs/V1_*_VALIDATION.md` files. They describe project history rather than the current beginner path.
|
||||
|
||||
## Development
|
||||
|
||||
The interpreter is implemented in `src/claro.c` and currently builds as a C99 program:
|
||||
|
||||
```bash
|
||||
make
|
||||
make test
|
||||
make check
|
||||
```
|
||||
|
||||
The repository includes examples, lessons, validation tools, and a test suite. Before submitting changes, run:
|
||||
|
||||
```bash
|
||||
./claro test
|
||||
./claro validate
|
||||
```
|
||||
No generated source or project header is required. See [C89 build notes](docs/C89.md)
|
||||
for platform dependencies, testing, and limitations.
|
||||
|
||||
## License
|
||||
|
||||
See [`LICENSE`](LICENSE) for the project license.
|
||||
See [LICENSE](LICENSE).
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
setlocal
|
||||
set CC=gcc
|
||||
if not "%~1"=="" set CC=%~1
|
||||
echo Building Claro v1.18.26...
|
||||
%CC% -std=c99 src\claro.c -O0 -o claro.exe -lm
|
||||
echo Building Claro (C89)...
|
||||
%CC% -std=c89 -pedantic-errors -Werror=implicit-function-declaration src\claro.c -O0 -o claro.exe -lm
|
||||
if errorlevel 1 (
|
||||
echo Build failed.
|
||||
exit /b 1
|
||||
|
||||
@@ -3,8 +3,8 @@ param(
|
||||
[string]$Out = "claro.exe"
|
||||
)
|
||||
|
||||
Write-Host "Building Claro v1.18.26..." -ForegroundColor Cyan
|
||||
& $CC "-std=c99" "src\claro.c" "-O0" "-o" $Out "-lm"
|
||||
Write-Host "Building Claro (C89)..." -ForegroundColor Cyan
|
||||
& $CC "-std=c89" "-pedantic-errors" "-Werror=implicit-function-declaration" "src\claro.c" "-O0" "-o" $Out "-lm"
|
||||
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
|
||||
|
||||
Write-Host "Built: $Out" -ForegroundColor Green
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
# Claro: single-file C89 runtime
|
||||
|
||||
The complete interpreter is `src/claro.c`. It needs no project-specific header,
|
||||
generated source, or second C implementation file. Tests, lessons, documentation,
|
||||
and optional scripts remain separate development resources, not build inputs.
|
||||
|
||||
## Build
|
||||
|
||||
```bash
|
||||
gcc -std=c89 -pedantic-errors -Werror=implicit-function-declaration src/claro.c -o claro -lm
|
||||
```
|
||||
|
||||
`make -s all` uses the same strict C89 gate and builds `claro` and `claro.exe`.
|
||||
The Windows build scripts select C89 too, but Windows compilation/runtime has
|
||||
not been verified by this Linux refactor. The `.exe` name built by Linux make
|
||||
still contains a Linux executable; it is not a Windows cross-build.
|
||||
|
||||
The source is formatted with four-space indentation and a 100-column limit.
|
||||
C99-only declarations, loop declarations, compound literals, and `long long`
|
||||
have been replaced without removing language features or compatibility syntax.
|
||||
|
||||
## Formatting and numbers
|
||||
|
||||
C89 does not define `snprintf` or `vsnprintf`. Claro uses a bounded internal
|
||||
formatter in the same source file. It supports only the fixed conversions used
|
||||
inside Claro, not arbitrary user-controlled printf formats. Strings are copied
|
||||
with explicit bounds; fixed numeric formats use C89 `sprintf` into a buffer
|
||||
sized for their maximum output. Unsupported internal formats fail explicitly.
|
||||
|
||||
Number display uses `modf` instead of casting to a non-C89 integer type.
|
||||
`random.int` computes the inclusive integer range with floating-point arithmetic
|
||||
and `fmod`, avoiding signed overflow across the tested 32-bit int range while
|
||||
preserving the existing seeded random algorithm. This is not cryptographic
|
||||
randomness and does not claim improved distribution.
|
||||
|
||||
## Platform requirements
|
||||
|
||||
C89 describes the C language and standard library, not an entire operating
|
||||
system. Directory listing, subprocesses, filesystem checks, and HTTP execution
|
||||
still use existing platform branches (POSIX or Windows); real HTTP needs curl.
|
||||
This is not proof of MSVC6, Windows 98, DOS, or freestanding-system support.
|
||||
Those environments need their own compiler, link, and runtime checks.
|
||||
|
||||
The C89 gate is tested with the host GCC and the host's integer/double model.
|
||||
It does not establish compatibility with every minimum-capability C89 compiler
|
||||
or an unusual integer/floating-point representation.
|
||||
|
||||
## Verify
|
||||
|
||||
```bash
|
||||
python3 tools/validate_c89.py
|
||||
python3 tools/validate_first_hour.py
|
||||
python3 tools/validate_v1_17.py
|
||||
```
|
||||
|
||||
The C89 validator copies only `claro.c` to an isolated directory, compiles it
|
||||
with strict flags, verifies that a deliberately C99-only source is rejected,
|
||||
and exercises bounded formatting/truncation, large and negative numbers,
|
||||
functions, and extreme random bounds. The full validation gate includes this
|
||||
check and the nine executable First Hour examples.
|
||||
|
||||
Sanitizer command for these portability boundaries:
|
||||
|
||||
```bash
|
||||
ASAN_OPTIONS=detect_leaks=0 UBSAN_OPTIONS=halt_on_error=1 CLARO_CC="gcc -fsanitize=address,undefined -g" python3 tools/validate_c89.py
|
||||
```
|
||||
|
||||
Disabling leak detection here isolates invalid memory access and undefined
|
||||
behavior checks; it is not a claim that every existing runtime path is leak-free.
|
||||
Historical validation scripts may retain their original C99 commands; current
|
||||
builds and current runtime/sanitizer validators use C89.
|
||||
@@ -1,6 +1,6 @@
|
||||
# Classroom Readiness Checklist
|
||||
|
||||
Claro v2026.10.20.155641 is suitable for beginner classroom-style testing of the stable console-language foundation. Advanced platform features should still be introduced carefully and only after the basics are comfortable.
|
||||
Claro v2026.10.20.160950 is suitable for beginner classroom-style testing of the stable console-language foundation. Advanced platform features should still be introduced carefully and only after the basics are comfortable.
|
||||
|
||||
## Ready to test
|
||||
|
||||
@@ -25,7 +25,7 @@ Claro v2026.10.20.155641 is suitable for beginner classroom-style testing of the
|
||||
## Recommended testing session
|
||||
|
||||
1. Build Claro or use the included executable.
|
||||
2. Run `claro --version` and confirm `Claro v2026.10.20.155641`.
|
||||
2. Run `claro --version` and confirm `Claro v2026.10.20.160950`.
|
||||
3. Run `claro test`.
|
||||
4. Run `claro validate`.
|
||||
5. Run `lessons/01_hello.claro`.
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
# Claro Command Line
|
||||
|
||||
Claro v2026.10.20.155641 supports these main commands:
|
||||
Claro v2026.10.20.160950 supports these main commands:
|
||||
|
||||
```bash
|
||||
claro file.claro
|
||||
@@ -58,7 +58,7 @@ claro package doctor
|
||||
claro package lock
|
||||
```
|
||||
|
||||
The v2026.10.20.155641 package command is a safer local project-file helper. It creates `claro.project`, `claro.lock`, and local folders under `packages/`. Package names may appear only once in `claro.project`; `claro package doctor` reports duplicate entries so the lockfile stays unambiguous. It also requires the project manifest to have exactly one non-empty `name:` field. It is not yet an online package registry.
|
||||
The v2026.10.20.160950 package command is a safer local project-file helper. It creates `claro.project`, `claro.lock`, and local folders under `packages/`. Package names may appear only once in `claro.project`; `claro package doctor` reports duplicate entries so the lockfile stays unambiguous. It also requires the project manifest to have exactly one non-empty `name:` field. It is not yet an online package registry.
|
||||
|
||||
## IDE metadata
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Claro Complete Platform Roadmap
|
||||
|
||||
Current release: **Claro v2026.10.20.155641**
|
||||
Current release: **Claro v2026.10.20.160950**
|
||||
|
||||
This roadmap tracks the larger goal: Claro as a complete beginner-friendly programming platform, not only a toy scripting interpreter.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Claro v2026.10.20.155641 Current Status
|
||||
# Claro v2026.10.20.160950 Current Status
|
||||
|
||||
This file is the beginner-safe status map for the current package. It separates what is ready to use from what is historical, experimental, or still planned.
|
||||
|
||||
@@ -11,7 +11,7 @@ This file is the beginner-safe status map for the current package. It separates
|
||||
|
||||
## Security and correctness review progress
|
||||
|
||||
The v2026.10.20.155641 review identified missing-argument reads in standard-library built-ins. The current runtime now validates required argument counts centrally before any builtin indexes `args[]`. Covered calls include `math.abs`, `math.clamp`, `random.seed`, `random.int`, text helpers, CSV helpers, path helpers, and collection helpers. Missing arguments produce a beginner-facing `needs N arguments` runtime error.
|
||||
The v2026.10.20.160950 review identified missing-argument reads in standard-library built-ins. The current runtime now validates required argument counts centrally before any builtin indexes `args[]`. Covered calls include `math.abs`, `math.clamp`, `random.seed`, `random.int`, text helpers, CSV helpers, path helpers, and collection helpers. Missing arguments produce a beginner-facing `needs N arguments` runtime error.
|
||||
|
||||
Focused regression coverage: `tests/38_builtin_arity.claro`, `tests/39_random_inverted_range.claro`, and `tests/40_call_depth_guard.claro`.
|
||||
|
||||
@@ -197,7 +197,7 @@ Ready now:
|
||||
- `claro package doctor` compares the complete manifest `checksum:` value, so a valid checksum followed by extra text is rejected
|
||||
- `claro package doctor` requires the complete supported `manifest-version: 1` value in `claro.project`, so a prefix such as `manifest-version: 10` is rejected
|
||||
- `claro package doctor` requires the complete supported `version: 1` value in each local package manifest, so a prefix such as `version: 10` is rejected
|
||||
- `claro package doctor` requires exactly one current `version: v2026.10.20.155641` line in `claro.lock`, so stale, missing, blank, or duplicate lockfile release versions are rejected
|
||||
- `claro package doctor` requires exactly one current `version: v2026.10.20.160950` line in `claro.lock`, so stale, missing, blank, or duplicate lockfile release versions are rejected
|
||||
- `claro package doctor` requires the complete supported `source: local` value in each local package manifest, so a prefix such as `source: local-extra` is rejected
|
||||
- package project entries must be unique; `claro package doctor`, `list`, `add`, `init`, and `lock` reject duplicate names instead of generating ambiguous package or lockfile data
|
||||
- lockfile package entries must also be unique; `claro package doctor` reports duplicate lock entries instead of accepting ambiguous package/checksum data
|
||||
@@ -301,7 +301,7 @@ Files named `RC*_NOTES.md`, `RC*_VALIDATION.md`, older `V1_*_VALIDATION.md`, and
|
||||
|
||||
## Which docs should a new learner trust first?
|
||||
|
||||
For the current v2026.10.20.155641 package, read docs in this order:
|
||||
For the current v2026.10.20.160950 package, read docs in this order:
|
||||
|
||||
1. `QUICK_START.md`, `FIRST_HOUR.md`, and `lessons/README.md` for first programs.
|
||||
2. `README.md` and this file for the current feature map.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Claro Final Release Checklist
|
||||
|
||||
Before publishing `Claro v2026.10.20.155641` as the current stable release:
|
||||
Before publishing `Claro v2026.10.20.160950` as the current stable release:
|
||||
|
||||
- Build from a clean unzip on Windows.
|
||||
- Build from a clean unzip on Linux or macOS.
|
||||
|
||||
@@ -79,6 +79,12 @@ DO add 2 3
|
||||
SAY RESULT
|
||||
```
|
||||
|
||||
Expected output:
|
||||
|
||||
```text
|
||||
5
|
||||
```
|
||||
|
||||
Older examples may use `TEACH add TAKES a, b`, `LEARNED`, and `CALL add WITH 2, 3`; those forms still work.
|
||||
|
||||
## 9. Save and load text
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Claro Graphics Status
|
||||
|
||||
Current release: **Claro v2026.10.20.155641**
|
||||
Current release: **Claro v2026.10.20.160950**
|
||||
|
||||
Graphics support is intentionally separated from the stable beginner console workflow.
|
||||
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Claro Performance and Optimization Notes
|
||||
|
||||
Current release: **Claro v2026.10.20.155641**
|
||||
Current release: **Claro v2026.10.20.160950**
|
||||
|
||||
Performance work should come after language behavior is stable and measured. Do not optimize blindly.
|
||||
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
# Claro documentation
|
||||
|
||||
## Learn — start here
|
||||
|
||||
1. [Quick start](QUICK_START.md) — build and run your first program.
|
||||
2. [First hour](FIRST_HOUR.md) — try one concept at a time.
|
||||
3. [Ten lessons](../lessons/README.md) — small programs in order.
|
||||
4. [Examples](../examples/) — try a quiz, guessing game, or shopping list.
|
||||
|
||||
## Look something up
|
||||
|
||||
- [Commands](CLI.md)
|
||||
- [Errors and repairs](ERRORS.md)
|
||||
- [Simple functions](SIMPLE_FUNCTIONS.md)
|
||||
- [Text helpers](TEXT_HELPERS.md)
|
||||
- [File and scripting helpers](PRACTICAL_SCRIPTING.md)
|
||||
|
||||
## For contributors
|
||||
|
||||
- [Build and test](../CONTRIBUTING.md)
|
||||
- [Learning-first rules](LEARNING_FIRST.md)
|
||||
- [Current roadmap](ROADMAP.md)
|
||||
- [Detailed implementation status](CURRENT_STATUS.md)
|
||||
- [Language specification](SPEC.md)
|
||||
- [Versioning](VERSIONING.md)
|
||||
|
||||
## History and optional features
|
||||
|
||||
Older RC notes, versioned validation reports, and platform-expansion plans
|
||||
remain in this directory for reference. They are not prerequisites for learning
|
||||
and are not the active roadmap. The [previous roadmap](history/ROADMAP_BEFORE_LEARNING_FIRST.md)
|
||||
records the earlier direction. Existing features have not been removed.
|
||||
+20
-187
@@ -1,196 +1,29 @@
|
||||
# Claro Roadmap
|
||||
|
||||
> **Current direction:** Follow [`LEARNING_FIRST.md`](LEARNING_FIRST.md) for
|
||||
> active priorities. The broader milestones below are historical planning
|
||||
> context, not a mandate to expand the language or a statement that features
|
||||
> have been removed.
|
||||
Claro is a **learning tool first**, not a race to add language features.
|
||||
The [learning-first charter](LEARNING_FIRST.md) guides every change.
|
||||
|
||||
Current release: **Claro v1.18.26**
|
||||
## Active priorities
|
||||
|
||||
Claro is now in the stable v1 development line. Older RC milestones are kept as historical notes in files such as `RC0_NOTES.md`, `RC3_NOTES.md`, and `RC9_VALIDATION.md`; they are not the current roadmap.
|
||||
1. **Make the first hour dependable.** Execute every lesson example and check its output, including input and simple functions.
|
||||
2. **Keep the rules consistent.** Teach one recommended syntax per concept; preserve older forms without putting alternatives in the first lessons.
|
||||
3. **Help learners recover.** Errors should identify the relevant line, explain the problem plainly, and show a small correction.
|
||||
4. **Teach in small steps.** One concept at a time, short exercises, and useful console projects such as quizzes, lists, and text-file tools.
|
||||
5. **Keep the core reliable.** Fix crashes and incorrect behavior with focused regression tests. Keep existing safety checks and compatibility tests.
|
||||
6. **Learn from real learners.** Test with people with different learning needs; record feedback without claiming accessibility has already been validated.
|
||||
|
||||
## Current direction
|
||||
## Out of scope without a new request
|
||||
|
||||
Keep Claro beginner-first while growing into a complete small programming platform:
|
||||
Advanced type systems, complex object models, concurrency, web frameworks,
|
||||
remote package registries, and new graphics systems. Existing implementations
|
||||
are preserved, not removed.
|
||||
|
||||
- readable syntax before clever syntax
|
||||
- friendly diagnostics before advanced compiler features
|
||||
- safe local/offline defaults before networked behavior
|
||||
- small features that are easy to teach, test, and document
|
||||
- normal feature releases inside the v1 line; reserve v2 for a future full rewrite
|
||||
## How work lands
|
||||
|
||||
## v1.18.26 status snapshot
|
||||
Make one small, tested improvement at a time. Update the relevant guide and
|
||||
run the [contributor checks](../CONTRIBUTING.md). A passing syntax check alone
|
||||
is not proof that a teaching example works.
|
||||
|
||||
See `CURRENT_STATUS.md` for the detailed feature matrix.
|
||||
|
||||
- Beginner scripting core: stable foundation
|
||||
- Objects/classes: foundation present; needs polish and stronger type checks
|
||||
- Package workflow: local foundation present; registry and publishing not complete
|
||||
- Networking: HTTP client foundation present; beginner web server not complete
|
||||
- Concurrency: deterministic task foundation; native threads not exposed as beginner API
|
||||
- Static typing: variables and containers foundation; function/object/import typing incomplete
|
||||
- IDE support: metadata/helper foundation; full editor/LSP experience incomplete
|
||||
- Graphics/SDL: experimental/planned; not enabled in the stable executable
|
||||
|
||||
## Near-term cleanup priorities
|
||||
|
||||
1. Keep beginner-facing docs current and separate from historical release notes.
|
||||
2. Keep examples aligned with the modern simple syntax (`END`, `DO`, short `SET`, short `ASK`) while documenting older compatibility forms separately.
|
||||
3. Expand validation around typecheck diagnostics and package/networking safety. Current Forgejo/Gitea CI runs the documented release gates (`claro validate`, typecheck diagnostics validation, version convention validation, package security validation, compiler warning validation, and CI workflow coverage validation). The compiler warning validator rebuilds `src/claro.c` and blocks path-truncation warnings; the workflow coverage validator checks executable `run` steps rather than comments and requires its own command. Current package safety validation covers safe project creation, rejecting unsafe project names during `claro new`, safe manifest/lockfile creation, rejecting unsafe package names during `package add`, detecting unsafe package names already present in `claro.project` during `package doctor`, refusing to write lockfile data for unsafe package names during `package lock`, making `package list` fail instead of displaying unsafe package entries as normal package names, making `package init` fail instead of reporting the project ready when unsafe package names are already present, making `package add` fail before changing files when unsafe package names are already present, making `package remove` fail instead of reporting success when unsafe package names remain during lockfile refresh, allowing `package remove` to remove an exact unsafe package entry so learners can repair a bad `claro.project`, making `package doctor` reject stale lockfile checksums for listed packages, and making `package doctor` reject lockfile package entries that are not listed in `claro.project`. Current function validation covers correct checked calls, wrong-type arguments, missing checked-argument diagnostics, missing unchecked-argument diagnostics for simple functions in both modern `DO greet` and empty compatibility `CALL greet WITH` forms, extra-argument diagnostics, and beginner-facing unknown-function diagnostics for mistyped modern `DO` and compatibility `CALL ... WITH` calls; current object-method parameter validation covers correct modern `DO object.method ...` and compatibility `CALL object.method WITH ...` checked calls, wrong-type diagnostics for both call forms, checked methods after another method in the same class, missing and extra checked-argument diagnostics including the extra-argument case for a checked method after another method in the same class, missing unchecked-argument diagnostics for simple object methods, missing-object guidance when `DO player.method ...` or compatibility `CALL object.method WITH ...` appears before `NEW` even if the method name is also wrong, and class-specific unknown-method diagnostics for both modern and compatibility calls when a learner calls a method the class does not declare; current object-field validation covers direct NUMBER/TEXT/YESNO field-assignment positives, direct object-field `CHECK TYPE` metadata positives for NUMBER/TEXT/YESNO fields, negative NUMBER/TEXT/YESNO field metadata mismatches, NUMBER/TEXT/YESNO-expectation unknown-field `CHECK TYPE` diagnostics, direct wrong-type field assignment diagnostics, field collection when a `HAS` field appears after a simple method, direct unknown-field diagnostics for NUMBER/TEXT/YESNO values, a beginner-facing fallback for unknown fields assigned from expressions whose type is not inferable yet, and missing-object diagnostics for both `SET object.field value` and `CHECK TYPE object.field IS TYPE` before `NEW`.
|
||||
3a. Keep package diagnostics actionable: invalid package manifest format fields now name the file and explain how to repair it, separately from an absent manifest. Keep package validation honest by checking that the project manifest has one non-empty project name, that the project and each listed package manifest declare the exact supported manifest version, package version, local source, and expected package name, and that lockfiles declare exactly one current release version.
|
||||
3b. Keep package security validation in Forgejo/Gitea CI so unsafe names, exact manifest-version/name/version/checksum mismatches, missing manifests, duplicate project manifest versions and packages, duplicate lock packages, duplicate package manifest names, versions, and checksums, and lockfile errors remain release blockers.
|
||||
4. Add small examples for each foundation feature before adding bigger syntax. The object-field foundation now includes positive and negative validation for explicitly typed NUMBER/TEXT assignments and field expressions such as `SET player.score player.name`, `SET player.score player.score + 1`, `SET player.name player.score + 1`, explicitly typed field assignments, explicit typed assignments to undeclared fields, simple and chained aliases such as `SET alias player`, `SET backup alias`, followed by `SET backup.score ...` or `CHECK TYPE backup.score IS ...`, chained aliases in object-method calls through both modern `DO` and compatibility `CALL ... WITH` forms (including a dedicated positive modern `DO` fixture), field-to-field, compound arithmetic field expressions, and arithmetic/text expression mismatches; typed containers also accept a map with nested type metadata when it is added to a `LIST OF MAP`; broader alias/control-flow checking remains planned.
|
||||
5. Keep the focused typecheck validator complete: the method-body field diagnostic fixtures are now exercised by `claro validate` alongside the standalone diagnostic validator; continue wiring each new `typecheck_*.claro` fixture into both gates. Modern and compatibility unknown-field expression diagnostics now have matching focused coverage, explicitly typed unknown method-field assignments have matching modern and compatibility fixtures with the expected `HAS field TYPE` repair hint, and short explicitly typed method-field assignments have matching modern and compatibility missing-value coverage.
|
||||
-6. Continue narrowing expression diagnostics: known TEXT operands now remain visible through arithmetic, with focused numeric-subtraction, numeric-division, and numeric-multiplication positives plus text-operand addition, subtraction, multiplication, and division coverage. Typed function returns now include positive subtraction and division examples alongside multiplication, including compatibility `TAKES` / `LEARNED` numeric-addition, subtraction, division, and multiplication return fixtures. Text concatenation into TEXT fields is covered in both operand orders, including field-to-field concatenation. Each numeric operator names the text operand and explains that it needs NUMBER values. Compatibility method return diagnostics now cover addition, subtraction, division, and multiplication. `CHECK TYPE` also rejects misspelled expected type names.
|
||||
- Keep typed method return examples balanced: numeric addition, subtraction, division, and multiplication now have dedicated positive compatibility `TAKES` / `LEARNED` method fixtures in the focused validator, alongside compatibility addition, subtraction, and division mismatch coverage and the existing method return mismatch diagnostics.
|
||||
- Keep method field examples balanced across syntax generations: modern and compatibility `TAKES` / `LEARNED` NUMBER, TEXT, and YESNO assignments now have positive fixtures beside the modern and compatibility mismatch fixtures, and modern plus compatibility YESNO method-field metadata now have dedicated positive fixtures beside the negative fixture.
|
||||
- Keep IDE metadata aligned with the current beginner syntax: typed-language keywords such as `RETURNS`, `CHECK`, and `TYPE` are now included in the metadata used by editor helpers.
|
||||
- Keep compatibility-call coverage aligned with modern calls: empty `CALL object.method WITH` forms now have a focused missing-argument diagnostic fixture alongside the modern `DO object.method` case.
|
||||
Keep declared return types honest: `claro typecheck` now reports friendly diagnostics for unknown declared return types, missing return types, mismatched, not-yet-inferable, and empty return expressions (including compatibility `TAKES` / `LEARNED` methods), declarations with no `RETURN` in modern and compatibility function forms, and incomplete conditional branches, when a simple function or object method declares `RETURNS TYPE`; missing-type coverage includes modern functions and both modern and compatibility methods, with a compatibility-function fixture as well. Incomplete conditional-return coverage now also includes the compatibility `TAKES` / `LEARNED` function spelling, so older lessons receive the same every-path diagnostic. The declaration keyword is case-insensitive like other Claro keywords, with positive coverage in modern and compatibility function forms, including lowercase compatibility declarations and lowercase compatibility method declarations, plus a lowercase compatibility-method mismatch fixture. Complete `IF`/`ELSE` return branches, including nested complete conditionals in functions and methods, are accepted, and modern and compatibility function syntax plus compatibility method syntax are covered by focused fixtures. `CHECK TYPE` parameter metadata also informs arithmetic return-expression checking, including object methods; positive numeric multiplication return coverage now sits beside the mismatch fixtures, including a dedicated compatibility-method multiplication success fixture; typed methods can also return class-declared fields by simple name, with positive and mismatch fixtures in both modern and compatibility method syntax, and unknown method return expressions now have dedicated modern and compatibility diagnostic fixtures, and NUMBER return expressions with known TEXT arithmetic operands identify the operation and offending operand, including focused addition, subtraction, multiplication, and division coverage for functions and methods. Compatibility method subtraction diagnostics are also covered alongside the existing addition diagnostic. Full path-sensitive analysis across nested conditionals and loops remains planned.
|
||||
|
||||
7. Keep method-body field diagnostics learner-facing: typed methods now name the class method when a simple class field receives a known mismatch in `CHECK TYPE` or assignment, or a known TEXT operand in a NUMBER expression, with matching text and numeric coverage in modern and compatibility method syntax; direct assignments to undeclared method fields now report the missing field when the value type is known, and bare `CHECK TYPE missing IS TYPE` statements inside methods now use the expected type in the repair hint in both modern and compatibility method syntax; broader control-flow and object-flow analysis remains planned.
|
||||
8: Keep method-body coverage balanced across beginner field types and syntax generations: YESNO field assignment mismatches are now validated for both modern `DO` and compatibility `CALL ... WITH` method syntax, method-body `CHECK TYPE` metadata mismatches now have matching compatibility `TAKES` / `LEARNED` coverage alongside the modern form, compatibility YESNO field metadata has dedicated positive and negative fixtures, and compatibility method assignments to undeclared fields have the same focused missing-field diagnostic as modern methods, including a beginner-facing fallback when the assigned expression is not inferable yet.
|
||||
8a. Keep method-body text expressions balanced: modern TEXT field concatenation is covered when the field is on either side of `+`, so both common beginner word-order patterns remain accepted.
|
||||
8b. Keep compatibility method-body text expressions aligned: `TAKES` / `LEARNED` methods now have positive TEXT concatenation coverage in both operand orders beside the modern `TEACH` / `END` examples.
|
||||
8c. Keep explicit method-field annotations aligned with class declarations: `SET score TEXT "oops"` inside a method with `HAS score NUMBER` now reports the declared field mismatch instead of accepting the inline annotation; broader annotation consistency remains planned.
|
||||
8d. Keep inline field annotations consistent with `HAS` declarations: `claro typecheck` now rejects conflicting annotations on method-body and direct object-field assignments, explains which type to use, and gives a known-type repair hint for unknown direct object-field annotations in both `AS ... TO` and short `SET field TYPE value` forms.
|
||||
8d.1. Keep direct field annotation forms balanced: the compatibility-shaped `SET player.score AS NUMBER TO 10` form now has a dedicated positive fixture beside short explicit annotations, so both accepted spellings remain protected by focused validation.
|
||||
8d.2. Keep method field annotation forms balanced: modern and compatibility methods now have dedicated positive fixtures for `SET score AS NUMBER TO 10`, so the compatibility-shaped annotation remains protected inside both supported method syntaxes.
|
||||
8d.3. Keep release validation aligned with method annotation coverage: the modern and compatibility `AS ... TO` method fixtures now run through `claro validate`, not only the focused Python diagnostic validator.
|
||||
8d.4. Keep separated direct field assignments unambiguous: `SET player.score AS NUMBER TO 10 extra` now reports the trailing text and explains the one-expression form instead of accepting a partially parsed value.
|
||||
8d.5. Keep short direct field assignments unambiguous: `SET player.score NUMBER 10 extra` now rejects trailing words with a repair hint, matching the separated `AS ... TO` form.
|
||||
8d.6. Keep separated direct field assignments complete: `SET player.score AS NUMBER TO` now explains that one value expression is required after `TO`.
|
||||
8d.7. Keep short direct field assignments complete: `SET player.score NUMBER` now explains that one value expression is required after the type.
|
||||
8d.8. Keep separated direct field assignments structurally complete: `SET player.score AS NUMBER` now explains that `TO` must appear before the value, with a complete repair example.
|
||||
8d.9. Keep untyped direct field assignments complete: `SET player.score` now explains that a value expression is required after the field name instead of silently accepting an empty assignment.
|
||||
8e. Keep inline method-field annotation coverage aligned across syntax generations: compatibility `TAKES` / `LEARNED` methods now have matching positive and negative fixtures, so older lessons retain the same class-declared-type guidance.
|
||||
8f. Keep inline method-field annotations learner-facing: an unknown annotation such as `BANANA` now names the field and method and suggests the `HAS` type instead of silently treating the annotation as an expression.
|
||||
8g. Keep unknown inline method-field annotation diagnostics aligned across syntax generations: compatibility `TAKES` / `LEARNED` methods now have matching focused coverage for misspelled annotations.
|
||||
8h. Keep function and method declarations unambiguous: `claro typecheck` now reports repeated parameter names with a repair hint, before duplicate names can make argument diagnostics confusing, including modern and compatibility `TAKES` / `LEARNED` functions and methods. Duplicate object method names within one class now get the same declaration-time protection and a rename hint, with focused coverage for both modern and compatibility method syntax. Broader signature validation remains planned.
|
||||
8h.1. Keep top-level function declarations unambiguous: duplicate `TEACH greet` blocks now get a declaration-time diagnostic with a rename hint, preventing two functions from competing for one name. Broader signature validation remains planned.
|
||||
8h.2. Keep function declarations understandable: a bare `TEACH` now gets a direct diagnostic explaining that a function name is required, with a small example repair. Broader signature validation remains planned.
|
||||
8h.3. Keep method declarations understandable: a bare `TEACH` inside a class now names the class and explains how to add a method name, instead of using the less-specific top-level function diagnostic.
|
||||
8i. Keep class declarations unambiguous: duplicate `HAS` field names within one class now get a declaration-time diagnostic with a repair hint, preventing conflicting field types from being silently accepted, while same-named fields in different classes remain valid. Broader object declaration validation remains planned.
|
||||
8j. Keep class names unambiguous: duplicate `CLASS Player` declarations now get a declaration-time diagnostic with a rename hint, preventing two class definitions from competing for one name. Extra words after a class name also get a declaration-time repair hint, so a typo such as `CLASS Player Extra` cannot silently create a surprising class identity.
|
||||
|
||||
8k. Keep object names unambiguous: repeated `NEW Player player` statements now get a declaration-time diagnostic with a rename hint, preventing one object type environment from silently replacing another.
|
||||
|
||||
8l. Keep object creation understandable: when classes are declared in a script, an unknown `NEW` class name now gets a direct class-name diagnostic and repair hint; the older permissive `NEW` behavior remains when no class declarations are present.
|
||||
|
||||
8m. Keep class field metadata understandable: a missing or unknown type in a `HAS field TYPE` declaration, or extra text after a valid type, now gets a class-and-field diagnostic with supported type examples or a direct repair hint before object-field checks use that metadata.
|
||||
8m.1. Keep class field declarations understandable: a bare `HAS` now gets a direct diagnostic explaining that both a field name and type are required, with a small `HAS score NUMBER` repair example.
|
||||
8n. Keep object creation unambiguous: extra words after `NEW ClassName object` now get a direct repair hint, so a malformed object declaration cannot silently discard part of the learner's input.
|
||||
|
||||
8o. Keep class declarations understandable: a bare `CLASS` now gets a direct diagnostic explaining that a class name is required, with a small example repair.
|
||||
|
||||
8p. Keep object declarations understandable: a `NEW` statement with a class but no object name now gets a direct diagnostic with a complete `NEW Player player` repair example; a bare `NEW` now separately explains that both a class and object name are required.
|
||||
|
||||
8q. Keep `CHECK TYPE` syntax understandable: a missing `IS` now gets a direct repair hint with a complete `CHECK TYPE score IS NUMBER` example.
|
||||
|
||||
8q.1. Keep `CHECK TYPE` declarations understandable: `CHECK TYPE score IS` now gets a direct repair hint naming the missing expected type and showing a complete example.
|
||||
|
||||
8q.2. Keep `CHECK TYPE` declarations unambiguous: extra words after a valid expected type now get a direct repair hint instead of being reported as an unknown type.
|
||||
8q.3. Keep `CHECK TYPE` declarations complete: a bare `CHECK TYPE` now explains that the expression, `IS`, and expected type are all required, with a complete repair example.
|
||||
8q.4. Keep `CHECK TYPE` declarations ordered: `CHECK TYPE IS NUMBER` now explains that an expression belongs before `IS`, with a complete repair example.
|
||||
8q.5. Keep `TYPE OF` declarations understandable: a missing `AS` now gets a direct repair hint with a complete `TYPE OF score AS kind` example.
|
||||
8q.5.1. Keep `TYPE OF` declarations complete: a missing expression before `AS` now gets a direct repair hint with a complete `TYPE OF score AS kind` example.
|
||||
8q.5.1a. Keep incomplete `TYPE OF` diagnostics focused: when the expression is missing, report that repair before secondary trailing-token errors.
|
||||
8q.5.2. Keep `TYPE OF` declarations named: a missing result name after `AS` now gets a direct repair hint with a complete `TYPE OF score AS kind` example.
|
||||
8q.5.3. Keep complete `TYPE OF` examples protected: the valid `TYPE OF score AS kind` form now has a positive fixture in the focused typecheck validation matrix.
|
||||
8q.5.3a. Keep `TYPE OF` keyword handling consistent: lowercase `type of score as kind` now has positive fixture coverage alongside the uppercase form.
|
||||
8q.5.3b. Keep `CHECK TYPE` keyword handling consistent: lowercase `check type score is number` now has positive fixture coverage alongside the uppercase form.
|
||||
8q.5.3c. Keep object-field examples consistent with keyword rules: lowercase `class`, `has`, `new`, `set`, and `check type` now have one focused positive typed-field fixture.
|
||||
8q.5.4. Keep bare `TYPE OF` declarations understandable: report that the expression, `AS`, and result name are all required, with a complete repair example.
|
||||
8q.6. Keep `TYPE OF` declarations unambiguous: extra words after the result name now get a direct repair hint instead of being silently included in the variable name.
|
||||
8q.7. Keep typed `TEACH` declarations unambiguous: extra words after a declared return type now get a direct repair hint instead of being treated as part of an unknown type.
|
||||
8q.8. Keep typed `TEACH` declarations complete: a bare `RETURNS` now gets a direct repair hint naming the missing type and showing a supported example such as `NUMBER`.
|
||||
8q.9. Keep missing return-type diagnostics aligned across functions and methods: modern and compatibility methods now name the complete `Class.method` identity when `RETURNS` has no type, with focused fixtures in the typecheck and release validation matrices.
|
||||
8q.10. Keep return statements beginner-readable: typed returns now identify simple extra tokens after a value and explain that `RETURN` accepts one expression, with focused release validation coverage.
|
||||
8q.11. Keep extra-token return diagnostics aligned across syntax generations: modern and compatibility functions and object methods now have focused fixtures for `RETURN value extra`, so errors keep the function or class-and-method name and the same repair hint.
|
||||
8q.12. Keep empty typed-return diagnostics aligned across syntax generations: modern and compatibility functions and object methods now have focused fixtures for bare `RETURN`, so each form explains that the declared type needs an expression.
|
||||
8q.13. Keep unknown typed-return diagnostics aligned across syntax generations: compatibility `TAKES` / `LEARNED` functions now have a focused fixture for an uninferable return expression, matching modern functions and methods.
|
||||
|
||||
### 1. Strong static types
|
||||
|
||||
Goal: make larger beginner programs safer without making first scripts harder.
|
||||
|
||||
Needed next:
|
||||
- richer typed function signatures beyond the focused simple `RETURNS TYPE` check
|
||||
- typed function returns beyond the focused simple function/method `RETURNS TYPE` check
|
||||
- type checking across branches and loops
|
||||
- typed imports/modules
|
||||
- broader object field checking and richer method return typing
|
||||
- clearer error messages for type mismatches
|
||||
|
||||
### 2. Objects and classes polish
|
||||
|
||||
Goal: keep object-oriented examples readable enough for beginners.
|
||||
|
||||
Needed next:
|
||||
- constructor-style defaults or beginner-friendly initialization helpers
|
||||
- richer method return checks beyond the focused simple `RETURNS TYPE` check
|
||||
- object printing/debugging helpers
|
||||
- better examples that avoid abstract toy OOP
|
||||
|
||||
### 3. Package manager and registry
|
||||
|
||||
Goal: make sharing beginner libraries safe and predictable.
|
||||
|
||||
Needed next:
|
||||
- local package install from a folder
|
||||
- version constraints
|
||||
- package export/publish format
|
||||
- lock-file verification
|
||||
- remote registry design with checksums/signatures before downloads
|
||||
|
||||
### 4. Networking and web apps
|
||||
|
||||
Goal: allow safe beginner networking and small local web apps.
|
||||
|
||||
Needed next:
|
||||
- beginner web server syntax
|
||||
- routes
|
||||
- request/response helpers
|
||||
- local-only safe default mode
|
||||
- examples that work offline or on localhost
|
||||
|
||||
### 5. Tasks, concurrency, and possible threads
|
||||
|
||||
Goal: teach concurrency as safe tasks first, not low-level thread hazards.
|
||||
|
||||
Needed next:
|
||||
- cooperative scheduler semantics
|
||||
- cancellation
|
||||
- timeouts
|
||||
- message passing or channels
|
||||
- explicit decision on whether native threads are needed later
|
||||
|
||||
### 6. IDE/editor support
|
||||
|
||||
Goal: give beginners fast feedback in their editor.
|
||||
|
||||
Needed next:
|
||||
- syntax highlighting grammar
|
||||
- editor extension packaging
|
||||
- hover/help text
|
||||
- go-to-definition where practical
|
||||
- code actions for common mistakes
|
||||
- LSP server after metadata and diagnostics stabilize
|
||||
|
||||
### 7. Graphics and SDL
|
||||
|
||||
Goal: make visual/game examples possible without making the portable stable build fragile.
|
||||
|
||||
Needed next:
|
||||
- keep placeholder graphics commands beginner-safe
|
||||
- define optional SDL build flag/backend
|
||||
- add graceful errors when graphics are unavailable
|
||||
- document which examples require experimental builds
|
||||
|
||||
## Documentation rule
|
||||
|
||||
Every new feature should update three places before it is treated as release-ready:
|
||||
|
||||
1. `README.md` or the relevant feature doc for beginner-facing usage
|
||||
2. `CURRENT_STATUS.md` for status and limitations
|
||||
3. a validation note or test command showing how it was checked
|
||||
See [current status](CURRENT_STATUS.md) for implementation details.
|
||||
The [previous roadmap](history/ROADMAP_BEFORE_LEARNING_FIRST.md) is retained
|
||||
as history, not an active development checklist.
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
SDL 1.2 support is **not included in the current stable executable**.
|
||||
|
||||
The `examples/experimental_sdl/` files are design experiments / future examples only. In Claro v2026.10.20.155641, running them with the included `claro.exe` will fail with:
|
||||
The `examples/experimental_sdl/` files are design experiments / future examples only. In Claro v2026.10.20.160950, running them with the included `claro.exe` will fail with:
|
||||
|
||||
```text
|
||||
Unknown command: SDL
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Claro Language Specification
|
||||
|
||||
Current package: **Claro v2026.10.20.155641**
|
||||
Current package: **Claro v2026.10.20.160950**
|
||||
Status: **Living v1 specification**
|
||||
|
||||
This document defines the intended behavior of the Claro language. It is written to reduce breaking changes and keep the v1 line teachable and predictable.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Claro v2026.10.20.155641 - Packages and Projects
|
||||
# Claro v2026.10.20.160950 - Packages and Projects
|
||||
|
||||
Claro v2026.10.20.155641 makes projects and packages safer and more useful while keeping the beginner syntax simple.
|
||||
Claro v2026.10.20.160950 makes projects and packages safer and more useful while keeping the beginner syntax simple.
|
||||
|
||||
## Create a project
|
||||
|
||||
@@ -28,7 +28,7 @@ README.md
|
||||
manifest-version: 1
|
||||
name: MyProject
|
||||
main: main.claro
|
||||
version: v2026.10.20.155641
|
||||
version: v2026.10.20.160950
|
||||
packages:
|
||||
package: text
|
||||
package: net_tools
|
||||
@@ -77,10 +77,10 @@ If `package doctor` reports `BAD lock checksum: math-tools`, check the `math-too
|
||||
BAD lock version: expected exactly one lock-version: 1 line
|
||||
```
|
||||
|
||||
The lockfile must also contain exactly one current release line, `version: v2026.10.20.155641`. A missing, stale, blank, or duplicate release line fails with:
|
||||
The lockfile must also contain exactly one current release line, `version: v2026.10.20.160950`. A missing, stale, blank, or duplicate release line fails with:
|
||||
|
||||
```text
|
||||
BAD lock release version: expected exactly one version: v2026.10.20.155641 line
|
||||
BAD lock release version: expected exactly one version: v2026.10.20.160950 line
|
||||
```
|
||||
|
||||
The doctor leaves your files unchanged. After reviewing your project and package manifests, run `claro package lock` to regenerate the lockfile, then run `claro package doctor` again. Spaces around values and capitalization of the lock-format field name are accepted, as with other lockfile fields. Valid generated lockfiles continue to work unchanged; this check does not add registry downloads or verify package content hashes.
|
||||
|
||||
+16
-20
@@ -1,31 +1,27 @@
|
||||
# Claro Versioning
|
||||
|
||||
Claro uses visible versions in this format:
|
||||
Development/release runs use their current UTC date and time:
|
||||
|
||||
```text
|
||||
v1.xx.yy
|
||||
vYYYY.MM.DD.HHMMSS
|
||||
```
|
||||
|
||||
Meaning:
|
||||
For example, `v2026.10.20.155641` identifies a run started on
|
||||
2026-10-20 at 15:56:41 UTC. A timestamp identifies a run, not its maturity.
|
||||
|
||||
```text
|
||||
v1 = overall major version
|
||||
xx = revision / release number
|
||||
yy = year
|
||||
At the start of a new development/release run:
|
||||
|
||||
```bash
|
||||
python3 tools/stamp_version.py
|
||||
make -s all
|
||||
```
|
||||
|
||||
Example:
|
||||
The stamper updates current runtime, IDE metadata, generated project and
|
||||
lockfile versions, validators, and selected current documentation. Historical
|
||||
release records are preserved. Rebuilding or testing within the same run
|
||||
retains the stamp; do not stamp again before each validation command.
|
||||
|
||||
```text
|
||||
Claro v1.15.26
|
||||
```
|
||||
Check the built version with `./claro --version`. Existing project lockfiles
|
||||
from older runs can be refreshed with `claro package lock`.
|
||||
|
||||
That means:
|
||||
|
||||
```text
|
||||
major version: 1
|
||||
revision: 10
|
||||
year: 2026
|
||||
```
|
||||
|
||||
Normal Claro development should stay in the `v1` line. A future `Claro v2` should mean an entire rewrite many years later, not a normal feature update.
|
||||
Older `v1.xx.yy` labels describe historical releases, not the current convention.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Claro Web Server Plan
|
||||
|
||||
Current release: **Claro v2026.10.20.155641**
|
||||
Current release: **Claro v2026.10.20.160950**
|
||||
|
||||
Claro currently has beginner HTTP client commands and offline `claro://` test URLs. A web server API is not complete yet.
|
||||
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
# Claro Roadmap
|
||||
|
||||
> **Current direction:** Follow [`LEARNING_FIRST.md`](../LEARNING_FIRST.md) for
|
||||
> active priorities. The broader milestones below are historical planning
|
||||
> context, not a mandate to expand the language or a statement that features
|
||||
> have been removed.
|
||||
|
||||
Current release: **Claro v1.18.26**
|
||||
|
||||
Claro is now in the stable v1 development line. Older RC milestones are kept as historical notes in files such as `RC0_NOTES.md`, `RC3_NOTES.md`, and `RC9_VALIDATION.md`; they are not the current roadmap.
|
||||
|
||||
## Current direction
|
||||
|
||||
Keep Claro beginner-first while growing into a complete small programming platform:
|
||||
|
||||
- readable syntax before clever syntax
|
||||
- friendly diagnostics before advanced compiler features
|
||||
- safe local/offline defaults before networked behavior
|
||||
- small features that are easy to teach, test, and document
|
||||
- normal feature releases inside the v1 line; reserve v2 for a future full rewrite
|
||||
|
||||
## v1.18.26 status snapshot
|
||||
|
||||
See `CURRENT_STATUS.md` for the detailed feature matrix.
|
||||
|
||||
- Beginner scripting core: stable foundation
|
||||
- Objects/classes: foundation present; needs polish and stronger type checks
|
||||
- Package workflow: local foundation present; registry and publishing not complete
|
||||
- Networking: HTTP client foundation present; beginner web server not complete
|
||||
- Concurrency: deterministic task foundation; native threads not exposed as beginner API
|
||||
- Static typing: variables and containers foundation; function/object/import typing incomplete
|
||||
- IDE support: metadata/helper foundation; full editor/LSP experience incomplete
|
||||
- Graphics/SDL: experimental/planned; not enabled in the stable executable
|
||||
|
||||
## Near-term cleanup priorities
|
||||
|
||||
1. Keep beginner-facing docs current and separate from historical release notes.
|
||||
2. Keep examples aligned with the modern simple syntax (`END`, `DO`, short `SET`, short `ASK`) while documenting older compatibility forms separately.
|
||||
3. Expand validation around typecheck diagnostics and package/networking safety. Current Forgejo/Gitea CI runs the documented release gates (`claro validate`, typecheck diagnostics validation, version convention validation, package security validation, compiler warning validation, and CI workflow coverage validation). The compiler warning validator rebuilds `src/claro.c` and blocks path-truncation warnings; the workflow coverage validator checks executable `run` steps rather than comments and requires its own command. Current package safety validation covers safe project creation, rejecting unsafe project names during `claro new`, safe manifest/lockfile creation, rejecting unsafe package names during `package add`, detecting unsafe package names already present in `claro.project` during `package doctor`, refusing to write lockfile data for unsafe package names during `package lock`, making `package list` fail instead of displaying unsafe package entries as normal package names, making `package init` fail instead of reporting the project ready when unsafe package names are already present, making `package add` fail before changing files when unsafe package names are already present, making `package remove` fail instead of reporting success when unsafe package names remain during lockfile refresh, allowing `package remove` to remove an exact unsafe package entry so learners can repair a bad `claro.project`, making `package doctor` reject stale lockfile checksums for listed packages, and making `package doctor` reject lockfile package entries that are not listed in `claro.project`. Current function validation covers correct checked calls, wrong-type arguments, missing checked-argument diagnostics, missing unchecked-argument diagnostics for simple functions in both modern `DO greet` and empty compatibility `CALL greet WITH` forms, extra-argument diagnostics, and beginner-facing unknown-function diagnostics for mistyped modern `DO` and compatibility `CALL ... WITH` calls; current object-method parameter validation covers correct modern `DO object.method ...` and compatibility `CALL object.method WITH ...` checked calls, wrong-type diagnostics for both call forms, checked methods after another method in the same class, missing and extra checked-argument diagnostics including the extra-argument case for a checked method after another method in the same class, missing unchecked-argument diagnostics for simple object methods, missing-object guidance when `DO player.method ...` or compatibility `CALL object.method WITH ...` appears before `NEW` even if the method name is also wrong, and class-specific unknown-method diagnostics for both modern and compatibility calls when a learner calls a method the class does not declare; current object-field validation covers direct NUMBER/TEXT/YESNO field-assignment positives, direct object-field `CHECK TYPE` metadata positives for NUMBER/TEXT/YESNO fields, negative NUMBER/TEXT/YESNO field metadata mismatches, NUMBER/TEXT/YESNO-expectation unknown-field `CHECK TYPE` diagnostics, direct wrong-type field assignment diagnostics, field collection when a `HAS` field appears after a simple method, direct unknown-field diagnostics for NUMBER/TEXT/YESNO values, a beginner-facing fallback for unknown fields assigned from expressions whose type is not inferable yet, and missing-object diagnostics for both `SET object.field value` and `CHECK TYPE object.field IS TYPE` before `NEW`.
|
||||
3a. Keep package diagnostics actionable: invalid package manifest format fields now name the file and explain how to repair it, separately from an absent manifest. Keep package validation honest by checking that the project manifest has one non-empty project name, that the project and each listed package manifest declare the exact supported manifest version, package version, local source, and expected package name, and that lockfiles declare exactly one current release version.
|
||||
3b. Keep package security validation in Forgejo/Gitea CI so unsafe names, exact manifest-version/name/version/checksum mismatches, missing manifests, duplicate project manifest versions and packages, duplicate lock packages, duplicate package manifest names, versions, and checksums, and lockfile errors remain release blockers.
|
||||
4. Add small examples for each foundation feature before adding bigger syntax. The object-field foundation now includes positive and negative validation for explicitly typed NUMBER/TEXT assignments and field expressions such as `SET player.score player.name`, `SET player.score player.score + 1`, `SET player.name player.score + 1`, explicitly typed field assignments, explicit typed assignments to undeclared fields, simple and chained aliases such as `SET alias player`, `SET backup alias`, followed by `SET backup.score ...` or `CHECK TYPE backup.score IS ...`, chained aliases in object-method calls through both modern `DO` and compatibility `CALL ... WITH` forms (including a dedicated positive modern `DO` fixture), field-to-field, compound arithmetic field expressions, and arithmetic/text expression mismatches; typed containers also accept a map with nested type metadata when it is added to a `LIST OF MAP`; broader alias/control-flow checking remains planned.
|
||||
5. Keep the focused typecheck validator complete: the method-body field diagnostic fixtures are now exercised by `claro validate` alongside the standalone diagnostic validator; continue wiring each new `typecheck_*.claro` fixture into both gates. Modern and compatibility unknown-field expression diagnostics now have matching focused coverage, explicitly typed unknown method-field assignments have matching modern and compatibility fixtures with the expected `HAS field TYPE` repair hint, and short explicitly typed method-field assignments have matching modern and compatibility missing-value coverage.
|
||||
-6. Continue narrowing expression diagnostics: known TEXT operands now remain visible through arithmetic, with focused numeric-subtraction, numeric-division, and numeric-multiplication positives plus text-operand addition, subtraction, multiplication, and division coverage. Typed function returns now include positive subtraction and division examples alongside multiplication, including compatibility `TAKES` / `LEARNED` numeric-addition, subtraction, division, and multiplication return fixtures. Text concatenation into TEXT fields is covered in both operand orders, including field-to-field concatenation. Each numeric operator names the text operand and explains that it needs NUMBER values. Compatibility method return diagnostics now cover addition, subtraction, division, and multiplication. `CHECK TYPE` also rejects misspelled expected type names.
|
||||
- Keep typed method return examples balanced: numeric addition, subtraction, division, and multiplication now have dedicated positive compatibility `TAKES` / `LEARNED` method fixtures in the focused validator, alongside compatibility addition, subtraction, and division mismatch coverage and the existing method return mismatch diagnostics.
|
||||
- Keep method field examples balanced across syntax generations: modern and compatibility `TAKES` / `LEARNED` NUMBER, TEXT, and YESNO assignments now have positive fixtures beside the modern and compatibility mismatch fixtures, and modern plus compatibility YESNO method-field metadata now have dedicated positive fixtures beside the negative fixture.
|
||||
- Keep IDE metadata aligned with the current beginner syntax: typed-language keywords such as `RETURNS`, `CHECK`, and `TYPE` are now included in the metadata used by editor helpers.
|
||||
- Keep compatibility-call coverage aligned with modern calls: empty `CALL object.method WITH` forms now have a focused missing-argument diagnostic fixture alongside the modern `DO object.method` case.
|
||||
Keep declared return types honest: `claro typecheck` now reports friendly diagnostics for unknown declared return types, missing return types, mismatched, not-yet-inferable, and empty return expressions (including compatibility `TAKES` / `LEARNED` methods), declarations with no `RETURN` in modern and compatibility function forms, and incomplete conditional branches, when a simple function or object method declares `RETURNS TYPE`; missing-type coverage includes modern functions and both modern and compatibility methods, with a compatibility-function fixture as well. Incomplete conditional-return coverage now also includes the compatibility `TAKES` / `LEARNED` function spelling, so older lessons receive the same every-path diagnostic. The declaration keyword is case-insensitive like other Claro keywords, with positive coverage in modern and compatibility function forms, including lowercase compatibility declarations and lowercase compatibility method declarations, plus a lowercase compatibility-method mismatch fixture. Complete `IF`/`ELSE` return branches, including nested complete conditionals in functions and methods, are accepted, and modern and compatibility function syntax plus compatibility method syntax are covered by focused fixtures. `CHECK TYPE` parameter metadata also informs arithmetic return-expression checking, including object methods; positive numeric multiplication return coverage now sits beside the mismatch fixtures, including a dedicated compatibility-method multiplication success fixture; typed methods can also return class-declared fields by simple name, with positive and mismatch fixtures in both modern and compatibility method syntax, and unknown method return expressions now have dedicated modern and compatibility diagnostic fixtures, and NUMBER return expressions with known TEXT arithmetic operands identify the operation and offending operand, including focused addition, subtraction, multiplication, and division coverage for functions and methods. Compatibility method subtraction diagnostics are also covered alongside the existing addition diagnostic. Full path-sensitive analysis across nested conditionals and loops remains planned.
|
||||
|
||||
7. Keep method-body field diagnostics learner-facing: typed methods now name the class method when a simple class field receives a known mismatch in `CHECK TYPE` or assignment, or a known TEXT operand in a NUMBER expression, with matching text and numeric coverage in modern and compatibility method syntax; direct assignments to undeclared method fields now report the missing field when the value type is known, and bare `CHECK TYPE missing IS TYPE` statements inside methods now use the expected type in the repair hint in both modern and compatibility method syntax; broader control-flow and object-flow analysis remains planned.
|
||||
8: Keep method-body coverage balanced across beginner field types and syntax generations: YESNO field assignment mismatches are now validated for both modern `DO` and compatibility `CALL ... WITH` method syntax, method-body `CHECK TYPE` metadata mismatches now have matching compatibility `TAKES` / `LEARNED` coverage alongside the modern form, compatibility YESNO field metadata has dedicated positive and negative fixtures, and compatibility method assignments to undeclared fields have the same focused missing-field diagnostic as modern methods, including a beginner-facing fallback when the assigned expression is not inferable yet.
|
||||
8a. Keep method-body text expressions balanced: modern TEXT field concatenation is covered when the field is on either side of `+`, so both common beginner word-order patterns remain accepted.
|
||||
8b. Keep compatibility method-body text expressions aligned: `TAKES` / `LEARNED` methods now have positive TEXT concatenation coverage in both operand orders beside the modern `TEACH` / `END` examples.
|
||||
8c. Keep explicit method-field annotations aligned with class declarations: `SET score TEXT "oops"` inside a method with `HAS score NUMBER` now reports the declared field mismatch instead of accepting the inline annotation; broader annotation consistency remains planned.
|
||||
8d. Keep inline field annotations consistent with `HAS` declarations: `claro typecheck` now rejects conflicting annotations on method-body and direct object-field assignments, explains which type to use, and gives a known-type repair hint for unknown direct object-field annotations in both `AS ... TO` and short `SET field TYPE value` forms.
|
||||
8d.1. Keep direct field annotation forms balanced: the compatibility-shaped `SET player.score AS NUMBER TO 10` form now has a dedicated positive fixture beside short explicit annotations, so both accepted spellings remain protected by focused validation.
|
||||
8d.2. Keep method field annotation forms balanced: modern and compatibility methods now have dedicated positive fixtures for `SET score AS NUMBER TO 10`, so the compatibility-shaped annotation remains protected inside both supported method syntaxes.
|
||||
8d.3. Keep release validation aligned with method annotation coverage: the modern and compatibility `AS ... TO` method fixtures now run through `claro validate`, not only the focused Python diagnostic validator.
|
||||
8d.4. Keep separated direct field assignments unambiguous: `SET player.score AS NUMBER TO 10 extra` now reports the trailing text and explains the one-expression form instead of accepting a partially parsed value.
|
||||
8d.5. Keep short direct field assignments unambiguous: `SET player.score NUMBER 10 extra` now rejects trailing words with a repair hint, matching the separated `AS ... TO` form.
|
||||
8d.6. Keep separated direct field assignments complete: `SET player.score AS NUMBER TO` now explains that one value expression is required after `TO`.
|
||||
8d.7. Keep short direct field assignments complete: `SET player.score NUMBER` now explains that one value expression is required after the type.
|
||||
8d.8. Keep separated direct field assignments structurally complete: `SET player.score AS NUMBER` now explains that `TO` must appear before the value, with a complete repair example.
|
||||
8d.9. Keep untyped direct field assignments complete: `SET player.score` now explains that a value expression is required after the field name instead of silently accepting an empty assignment.
|
||||
8e. Keep inline method-field annotation coverage aligned across syntax generations: compatibility `TAKES` / `LEARNED` methods now have matching positive and negative fixtures, so older lessons retain the same class-declared-type guidance.
|
||||
8f. Keep inline method-field annotations learner-facing: an unknown annotation such as `BANANA` now names the field and method and suggests the `HAS` type instead of silently treating the annotation as an expression.
|
||||
8g. Keep unknown inline method-field annotation diagnostics aligned across syntax generations: compatibility `TAKES` / `LEARNED` methods now have matching focused coverage for misspelled annotations.
|
||||
8h. Keep function and method declarations unambiguous: `claro typecheck` now reports repeated parameter names with a repair hint, before duplicate names can make argument diagnostics confusing, including modern and compatibility `TAKES` / `LEARNED` functions and methods. Duplicate object method names within one class now get the same declaration-time protection and a rename hint, with focused coverage for both modern and compatibility method syntax. Broader signature validation remains planned.
|
||||
8h.1. Keep top-level function declarations unambiguous: duplicate `TEACH greet` blocks now get a declaration-time diagnostic with a rename hint, preventing two functions from competing for one name. Broader signature validation remains planned.
|
||||
8h.2. Keep function declarations understandable: a bare `TEACH` now gets a direct diagnostic explaining that a function name is required, with a small example repair. Broader signature validation remains planned.
|
||||
8h.3. Keep method declarations understandable: a bare `TEACH` inside a class now names the class and explains how to add a method name, instead of using the less-specific top-level function diagnostic.
|
||||
8i. Keep class declarations unambiguous: duplicate `HAS` field names within one class now get a declaration-time diagnostic with a repair hint, preventing conflicting field types from being silently accepted, while same-named fields in different classes remain valid. Broader object declaration validation remains planned.
|
||||
8j. Keep class names unambiguous: duplicate `CLASS Player` declarations now get a declaration-time diagnostic with a rename hint, preventing two class definitions from competing for one name. Extra words after a class name also get a declaration-time repair hint, so a typo such as `CLASS Player Extra` cannot silently create a surprising class identity.
|
||||
|
||||
8k. Keep object names unambiguous: repeated `NEW Player player` statements now get a declaration-time diagnostic with a rename hint, preventing one object type environment from silently replacing another.
|
||||
|
||||
8l. Keep object creation understandable: when classes are declared in a script, an unknown `NEW` class name now gets a direct class-name diagnostic and repair hint; the older permissive `NEW` behavior remains when no class declarations are present.
|
||||
|
||||
8m. Keep class field metadata understandable: a missing or unknown type in a `HAS field TYPE` declaration, or extra text after a valid type, now gets a class-and-field diagnostic with supported type examples or a direct repair hint before object-field checks use that metadata.
|
||||
8m.1. Keep class field declarations understandable: a bare `HAS` now gets a direct diagnostic explaining that both a field name and type are required, with a small `HAS score NUMBER` repair example.
|
||||
8n. Keep object creation unambiguous: extra words after `NEW ClassName object` now get a direct repair hint, so a malformed object declaration cannot silently discard part of the learner's input.
|
||||
|
||||
8o. Keep class declarations understandable: a bare `CLASS` now gets a direct diagnostic explaining that a class name is required, with a small example repair.
|
||||
|
||||
8p. Keep object declarations understandable: a `NEW` statement with a class but no object name now gets a direct diagnostic with a complete `NEW Player player` repair example; a bare `NEW` now separately explains that both a class and object name are required.
|
||||
|
||||
8q. Keep `CHECK TYPE` syntax understandable: a missing `IS` now gets a direct repair hint with a complete `CHECK TYPE score IS NUMBER` example.
|
||||
|
||||
8q.1. Keep `CHECK TYPE` declarations understandable: `CHECK TYPE score IS` now gets a direct repair hint naming the missing expected type and showing a complete example.
|
||||
|
||||
8q.2. Keep `CHECK TYPE` declarations unambiguous: extra words after a valid expected type now get a direct repair hint instead of being reported as an unknown type.
|
||||
8q.3. Keep `CHECK TYPE` declarations complete: a bare `CHECK TYPE` now explains that the expression, `IS`, and expected type are all required, with a complete repair example.
|
||||
8q.4. Keep `CHECK TYPE` declarations ordered: `CHECK TYPE IS NUMBER` now explains that an expression belongs before `IS`, with a complete repair example.
|
||||
8q.5. Keep `TYPE OF` declarations understandable: a missing `AS` now gets a direct repair hint with a complete `TYPE OF score AS kind` example.
|
||||
8q.5.1. Keep `TYPE OF` declarations complete: a missing expression before `AS` now gets a direct repair hint with a complete `TYPE OF score AS kind` example.
|
||||
8q.5.1a. Keep incomplete `TYPE OF` diagnostics focused: when the expression is missing, report that repair before secondary trailing-token errors.
|
||||
8q.5.2. Keep `TYPE OF` declarations named: a missing result name after `AS` now gets a direct repair hint with a complete `TYPE OF score AS kind` example.
|
||||
8q.5.3. Keep complete `TYPE OF` examples protected: the valid `TYPE OF score AS kind` form now has a positive fixture in the focused typecheck validation matrix.
|
||||
8q.5.3a. Keep `TYPE OF` keyword handling consistent: lowercase `type of score as kind` now has positive fixture coverage alongside the uppercase form.
|
||||
8q.5.3b. Keep `CHECK TYPE` keyword handling consistent: lowercase `check type score is number` now has positive fixture coverage alongside the uppercase form.
|
||||
8q.5.3c. Keep object-field examples consistent with keyword rules: lowercase `class`, `has`, `new`, `set`, and `check type` now have one focused positive typed-field fixture.
|
||||
8q.5.4. Keep bare `TYPE OF` declarations understandable: report that the expression, `AS`, and result name are all required, with a complete repair example.
|
||||
8q.6. Keep `TYPE OF` declarations unambiguous: extra words after the result name now get a direct repair hint instead of being silently included in the variable name.
|
||||
8q.7. Keep typed `TEACH` declarations unambiguous: extra words after a declared return type now get a direct repair hint instead of being treated as part of an unknown type.
|
||||
8q.8. Keep typed `TEACH` declarations complete: a bare `RETURNS` now gets a direct repair hint naming the missing type and showing a supported example such as `NUMBER`.
|
||||
8q.9. Keep missing return-type diagnostics aligned across functions and methods: modern and compatibility methods now name the complete `Class.method` identity when `RETURNS` has no type, with focused fixtures in the typecheck and release validation matrices.
|
||||
8q.10. Keep return statements beginner-readable: typed returns now identify simple extra tokens after a value and explain that `RETURN` accepts one expression, with focused release validation coverage.
|
||||
8q.11. Keep extra-token return diagnostics aligned across syntax generations: modern and compatibility functions and object methods now have focused fixtures for `RETURN value extra`, so errors keep the function or class-and-method name and the same repair hint.
|
||||
8q.12. Keep empty typed-return diagnostics aligned across syntax generations: modern and compatibility functions and object methods now have focused fixtures for bare `RETURN`, so each form explains that the declared type needs an expression.
|
||||
8q.13. Keep unknown typed-return diagnostics aligned across syntax generations: compatibility `TAKES` / `LEARNED` functions now have a focused fixture for an uninferable return expression, matching modern functions and methods.
|
||||
|
||||
### 1. Strong static types
|
||||
|
||||
Goal: make larger beginner programs safer without making first scripts harder.
|
||||
|
||||
Needed next:
|
||||
- richer typed function signatures beyond the focused simple `RETURNS TYPE` check
|
||||
- typed function returns beyond the focused simple function/method `RETURNS TYPE` check
|
||||
- type checking across branches and loops
|
||||
- typed imports/modules
|
||||
- broader object field checking and richer method return typing
|
||||
- clearer error messages for type mismatches
|
||||
|
||||
### 2. Objects and classes polish
|
||||
|
||||
Goal: keep object-oriented examples readable enough for beginners.
|
||||
|
||||
Needed next:
|
||||
- constructor-style defaults or beginner-friendly initialization helpers
|
||||
- richer method return checks beyond the focused simple `RETURNS TYPE` check
|
||||
- object printing/debugging helpers
|
||||
- better examples that avoid abstract toy OOP
|
||||
|
||||
### 3. Package manager and registry
|
||||
|
||||
Goal: make sharing beginner libraries safe and predictable.
|
||||
|
||||
Needed next:
|
||||
- local package install from a folder
|
||||
- version constraints
|
||||
- package export/publish format
|
||||
- lock-file verification
|
||||
- remote registry design with checksums/signatures before downloads
|
||||
|
||||
### 4. Networking and web apps
|
||||
|
||||
Goal: allow safe beginner networking and small local web apps.
|
||||
|
||||
Needed next:
|
||||
- beginner web server syntax
|
||||
- routes
|
||||
- request/response helpers
|
||||
- local-only safe default mode
|
||||
- examples that work offline or on localhost
|
||||
|
||||
### 5. Tasks, concurrency, and possible threads
|
||||
|
||||
Goal: teach concurrency as safe tasks first, not low-level thread hazards.
|
||||
|
||||
Needed next:
|
||||
- cooperative scheduler semantics
|
||||
- cancellation
|
||||
- timeouts
|
||||
- message passing or channels
|
||||
- explicit decision on whether native threads are needed later
|
||||
|
||||
### 6. IDE/editor support
|
||||
|
||||
Goal: give beginners fast feedback in their editor.
|
||||
|
||||
Needed next:
|
||||
- syntax highlighting grammar
|
||||
- editor extension packaging
|
||||
- hover/help text
|
||||
- go-to-definition where practical
|
||||
- code actions for common mistakes
|
||||
- LSP server after metadata and diagnostics stabilize
|
||||
|
||||
### 7. Graphics and SDL
|
||||
|
||||
Goal: make visual/game examples possible without making the portable stable build fragile.
|
||||
|
||||
Needed next:
|
||||
- keep placeholder graphics commands beginner-safe
|
||||
- define optional SDL build flag/backend
|
||||
- add graceful errors when graphics are unavailable
|
||||
- document which examples require experimental builds
|
||||
|
||||
## Documentation rule
|
||||
|
||||
Every new feature should update three places before it is treated as release-ready:
|
||||
|
||||
1. `README.md` or the relevant feature doc for beginner-facing usage
|
||||
2. `CURRENT_STATUS.md` for status and limitations
|
||||
3. a validation note or test command showing how it was checked
|
||||
+7710
-730
File diff suppressed because one or more lines are too long
+1
-1
@@ -9,7 +9,7 @@ ROOT = pathlib.Path(__file__).resolve().parent.parent
|
||||
CLARO = ROOT / ("claro.exe" if os.name == "nt" else "claro")
|
||||
|
||||
if not CLARO.exists():
|
||||
print("Build first: gcc -std=c99 src/claro.c -O0 -o " + ("claro.exe" if os.name == "nt" else "claro") + " -lm")
|
||||
print("Build first: gcc -std=c89 -pedantic-errors src/claro.c -O0 -o " + ("claro.exe" if os.name == "nt" else "claro") + " -lm")
|
||||
raise SystemExit(2)
|
||||
|
||||
raise SystemExit(subprocess.call([str(CLARO), "test"], cwd=str(ROOT)))
|
||||
|
||||
@@ -22,7 +22,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Compile the single source in isolation and exercise C89 portability boundaries."""
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shlex
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
FLAGS = ['-std=c89', '-pedantic-errors', '-Werror=implicit-function-declaration']
|
||||
|
||||
|
||||
def main():
|
||||
cc = shlex.split(os.environ.get('CLARO_CC', 'gcc'))
|
||||
with tempfile.TemporaryDirectory(prefix='claro-c89-', dir=os.environ.get('TMPDIR')) as directory:
|
||||
work = Path(directory)
|
||||
source = work / 'claro.c'
|
||||
source.write_bytes((ROOT / 'src/claro.c').read_bytes())
|
||||
exe = work / ('claro.exe' if os.name == 'nt' else 'claro')
|
||||
subprocess.run(cc + FLAGS + [str(source), '-o', str(exe), '-lm'], check=True)
|
||||
unit = work / 'format_probe.c'
|
||||
unit.write_text(r'''#define main claro_application_main
|
||||
#include "claro.c"
|
||||
#undef main
|
||||
#include <assert.h>
|
||||
int main(void)
|
||||
{
|
||||
char guard[8] = "abcdefg";
|
||||
char buffer[400];
|
||||
char *number;
|
||||
int result;
|
||||
result=claro_snprintf(guard+1,4,"%s","123456");
|
||||
assert(result==6 && guard[0]=='a' && guard[5]=='f');
|
||||
assert(strcmp(guard+1,"123")==0);
|
||||
assert(claro_snprintf(NULL,0,"%s:%d","hello",-12)==9);
|
||||
assert(claro_snprintf(guard,1,"%s","hello")==5 && guard[0]==0);
|
||||
assert(claro_snprintf(buffer,sizeof(buffer),"%.*s",3,"abcdef")==3);
|
||||
assert(strcmp(buffer,"abc")==0);
|
||||
assert(claro_snprintf(buffer,sizeof(buffer),"%.*s",-1,"abc")==3);
|
||||
assert(strcmp(buffer,"abc")==0);
|
||||
claro_snprintf(buffer,sizeof(buffer),"%08lx %.15g %.0f %%",(unsigned long)42,1.25,3.0);
|
||||
assert(strcmp(buffer,"0000002a 1.25 3 %")==0);
|
||||
claro_snprintf(buffer,sizeof(buffer),"%.0f",DBL_MAX);
|
||||
assert(strlen(buffer)<sizeof(buffer));
|
||||
number=num_to_string(-0.0); assert(strcmp(number,"0")==0); free(number);
|
||||
return 0;
|
||||
}
|
||||
''')
|
||||
unit_exe = work / ('format_probe.exe' if os.name == 'nt' else 'format_probe')
|
||||
subprocess.run(cc + FLAGS + [str(unit), '-o', str(unit_exe), '-lm'], check=True)
|
||||
subprocess.run([str(unit_exe)], cwd=work, check=True)
|
||||
invalid = work / 'invalid.c'
|
||||
invalid.write_text('int main(void) { int n = 0; n++; int late = 1; return late; }\n')
|
||||
bad = subprocess.run(cc + FLAGS + ['-fsyntax-only', str(invalid)], capture_output=True, text=True)
|
||||
assert bad.returncode != 0 and 'error' in bad.stderr.lower(), 'C89 compiler gate accepted invalid C99 syntax'
|
||||
script = work / 'probe.claro'
|
||||
script.write_text('''TEACH add a b
|
||||
RETURN a + b
|
||||
END
|
||||
DO add 2 3
|
||||
SAY RESULT
|
||||
SAY 2147483648
|
||||
SAY -2147483649
|
||||
SAY 9007199254740991
|
||||
SAY -2.5
|
||||
IMPORT "lib/random.claro" AS random
|
||||
DO random.seed 1
|
||||
DO random.int -2147483648 2147483647
|
||||
SET sample RESULT
|
||||
IF sample >= -2147483648
|
||||
IF sample <= 2147483647
|
||||
SAY "range OK"
|
||||
END
|
||||
END
|
||||
''')
|
||||
run = subprocess.run([str(exe), str(script)], cwd=work, text=True, capture_output=True)
|
||||
expected = '5\n2147483648\n-2147483649\n9007199254740991\n-2.5\nrange OK\n'
|
||||
assert run.returncode == 0 and run.stdout == expected, (run.returncode, run.stdout, run.stderr)
|
||||
print('PASS: standalone strict C89 build, rejected C99 fixture, bounded formatting, functions, numbers, extreme random bounds')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
@@ -19,7 +19,7 @@ def main() -> int:
|
||||
script = tmp_path / "tokens.claro"
|
||||
script.write_text('SAY "a repeated string literal"\n' * 2000, encoding="utf-8")
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -10,7 +10,7 @@ ROOT = Path(__file__).resolve().parents[1]
|
||||
def main():
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
result = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-c", "src/claro.c", "-o", str(Path(tmp) / "claro.o")],
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-c", "src/claro.c", "-o", str(Path(tmp) / "claro.o")],
|
||||
cwd=ROOT,
|
||||
text=True,
|
||||
capture_output=True,
|
||||
|
||||
@@ -35,7 +35,7 @@ def main() -> int:
|
||||
)
|
||||
build = subprocess.run(
|
||||
[
|
||||
"gcc", "-std=c99", "-O0", "-g",
|
||||
"gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g",
|
||||
"-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm",
|
||||
], cwd=ROOT, text=True, capture_output=True,
|
||||
|
||||
@@ -26,7 +26,7 @@ def main() -> int:
|
||||
)
|
||||
build = subprocess.run(
|
||||
[
|
||||
"gcc", "-std=c99", "-O0", "-g",
|
||||
"gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g",
|
||||
"-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm",
|
||||
], cwd=ROOT, text=True, capture_output=True,
|
||||
|
||||
@@ -23,7 +23,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ def main() -> int:
|
||||
+ 'SAY item_count\n', encoding="utf-8"
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -29,7 +29,7 @@ def main() -> int:
|
||||
)
|
||||
build = subprocess.run(
|
||||
[
|
||||
"gcc", "-std=c99", "-O0", "-g",
|
||||
"gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g",
|
||||
"-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm",
|
||||
], cwd=ROOT, text=True, capture_output=True,
|
||||
|
||||
@@ -23,7 +23,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Execute every Claro code block in docs/FIRST_HOUR.md and check its output."""
|
||||
from pathlib import Path
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
EXE = ROOT / ("claro.exe" if os.name == "nt" else "claro")
|
||||
INPUTS = {2: "Ada\n", 5: "4\n"}
|
||||
EXPECTED = {
|
||||
1: "Hello!\n",
|
||||
2: "What is your name?\nHello Ada\n",
|
||||
3: "0\n",
|
||||
4: "1\n",
|
||||
5: "What is 2 + 2?\nCorrect!\n",
|
||||
6: "Practice helps\nPractice helps\nPractice helps\n",
|
||||
7: "milk\nbread\n",
|
||||
8: "5\n",
|
||||
9: "Hello\n",
|
||||
}
|
||||
|
||||
|
||||
def main() -> int:
|
||||
text = (ROOT / "docs/FIRST_HOUR.md").read_text(encoding="utf-8")
|
||||
blocks = re.findall(r"```claro\s*\n(.*?)\n```", text, flags=re.DOTALL)
|
||||
if len(blocks) != len(EXPECTED):
|
||||
print(f"FAIL: expected {len(EXPECTED)} Claro blocks, found {len(blocks)}")
|
||||
return 1
|
||||
with tempfile.TemporaryDirectory(prefix="claro-first-hour-") as tmp:
|
||||
for number, block in enumerate(blocks, 1):
|
||||
script = Path(tmp) / f"block-{number}.claro"
|
||||
script.write_text(block + "\n", encoding="utf-8")
|
||||
run = subprocess.run([str(EXE), str(script)], cwd=tmp,
|
||||
input=INPUTS.get(number, ""), text=True,
|
||||
capture_output=True)
|
||||
if run.returncode or run.stdout != EXPECTED[number]:
|
||||
print(f"FAIL: First Hour block {number}: exit={run.returncode}")
|
||||
print(f"expected stdout: {EXPECTED[number]!r}")
|
||||
print(f"actual stdout: {run.stdout!r}")
|
||||
print(run.stderr, end="", file=sys.stderr)
|
||||
return 1
|
||||
print(f"PASS: First Hour block {number}")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
@@ -21,7 +21,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -16,7 +16,7 @@ def main() -> int:
|
||||
with tempfile.TemporaryDirectory(prefix="get-at-cleanup-") as tmp:
|
||||
binary = Path(tmp) / "claro-asan"
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -23,7 +23,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -43,7 +43,7 @@ def main() -> int:
|
||||
)
|
||||
binary = tmp_path / "claro-http"
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "src/claro.c", "-o", str(binary), "-lm"],
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
if build.returncode:
|
||||
|
||||
@@ -24,7 +24,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -35,7 +35,7 @@ def main() -> int:
|
||||
)
|
||||
build = subprocess.run(
|
||||
[
|
||||
"gcc", "-std=c99", "-O0", "-g",
|
||||
"gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g",
|
||||
"-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm",
|
||||
], cwd=ROOT, text=True, capture_output=True,
|
||||
|
||||
@@ -6,7 +6,7 @@ from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
EXE = ROOT / ("claro.exe" if os.name == "nt" else "claro")
|
||||
EXPECTED_VERSION = "Claro v2026.10.20.155641"
|
||||
EXPECTED_VERSION = "Claro v2026.10.20.160950"
|
||||
|
||||
|
||||
def fail(message):
|
||||
@@ -57,11 +57,11 @@ def main():
|
||||
fail(out)
|
||||
starter = work / "StarterApp"
|
||||
starter_project = read(starter / "claro.project")
|
||||
for phrase in ["manifest-version: 1", "name: StarterApp", "main: main.claro", "version: v2026.10.20.155641", "packages:"]:
|
||||
for phrase in ["manifest-version: 1", "name: StarterApp", "main: main.claro", "version: v2026.10.20.160950", "packages:"]:
|
||||
if phrase not in starter_project:
|
||||
fail(f"claro new project file missing {phrase!r}:\n{starter_project}")
|
||||
starter_lock = read(starter / "claro.lock")
|
||||
for phrase in ["lock-version: 1", "version: v2026.10.20.155641"]:
|
||||
for phrase in ["lock-version: 1", "version: v2026.10.20.160950"]:
|
||||
if phrase not in starter_lock:
|
||||
fail(f"claro new lockfile missing {phrase!r}:\n{starter_lock}")
|
||||
|
||||
@@ -71,7 +71,7 @@ def main():
|
||||
if rc != 0:
|
||||
fail(out)
|
||||
project = read(work / "claro.project")
|
||||
for phrase in ["manifest-version: 1", "name: ClaroProject", "main: main.claro", "version: v2026.10.20.155641", "packages:"]:
|
||||
for phrase in ["manifest-version: 1", "name: ClaroProject", "main: main.claro", "version: v2026.10.20.160950", "packages:"]:
|
||||
if phrase not in project:
|
||||
fail(f"claro.project missing {phrase!r}:\n{project}")
|
||||
|
||||
@@ -100,7 +100,7 @@ def main():
|
||||
fail(f"Package checksum should be a stable non-placeholder value, got {checksum!r}")
|
||||
|
||||
lock = read(work / "claro.lock")
|
||||
for phrase in ["lock-version: 1", "version: v2026.10.20.155641", "package: math-tools", "checksum:"]:
|
||||
for phrase in ["lock-version: 1", "version: v2026.10.20.160950", "package: math-tools", "checksum:"]:
|
||||
if phrase not in lock:
|
||||
fail(f"claro.lock missing {phrase!r}:\n{lock}")
|
||||
|
||||
@@ -127,12 +127,12 @@ def main():
|
||||
fail(f"Lock format-version diagnostic was unclear:\n{out}")
|
||||
if read(work / "claro.lock") != invalid_lock:
|
||||
fail("package doctor must not rewrite an invalid lock format version")
|
||||
invalid_release_lock = lock.replace("version: v2026.10.20.155641", "version: v1.18.25", 1)
|
||||
invalid_release_lock = lock.replace("version: v2026.10.20.160950", "version: v1.18.25", 1)
|
||||
(work / "claro.lock").write_text(invalid_release_lock, encoding="utf-8")
|
||||
rc, out = run([str(EXE), "package", "doctor"], work)
|
||||
if rc == 0:
|
||||
fail("package doctor must reject a lockfile for a different Claro release")
|
||||
if "BAD lock release version: expected exactly one version: v2026.10.20.155641 line" not in out:
|
||||
if "BAD lock release version: expected exactly one version: v2026.10.20.160950 line" not in out:
|
||||
fail(f"Lock release-version diagnostic was unclear:\n{out}")
|
||||
if read(work / "claro.lock") != invalid_release_lock:
|
||||
fail("package doctor must not rewrite an invalid lock release version")
|
||||
@@ -343,7 +343,7 @@ def main():
|
||||
fail("Long package name should not create a package folder")
|
||||
|
||||
(work / "claro.project").write_text(
|
||||
"manifest-version: 1\nname: ClaroProject\nmain: main.claro\nversion: v2026.10.20.155641\npackages:\npackage: ../bad\n",
|
||||
"manifest-version: 1\nname: ClaroProject\nmain: main.claro\nversion: v2026.10.20.160950\npackages:\npackage: ../bad\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
rc, out = run([str(EXE), "package", "doctor"], work)
|
||||
@@ -382,7 +382,7 @@ def main():
|
||||
fail("package add should not create a package folder while unsafe names remain in claro.project")
|
||||
|
||||
(work / "claro.project").write_text(
|
||||
"manifest-version: 1\nname: ClaroProject\nmain: main.claro\nversion: v2026.10.20.155641\npackages:\npackage: math-tools\npackage: ../bad\n",
|
||||
"manifest-version: 1\nname: ClaroProject\nmain: main.claro\nversion: v2026.10.20.160950\npackages:\npackage: math-tools\npackage: ../bad\n",
|
||||
encoding="utf-8",
|
||||
)
|
||||
rc, out = run([str(EXE), "package", "remove", "math-tools"], work)
|
||||
|
||||
@@ -22,7 +22,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ def main() -> int:
|
||||
script.write_text((f'READ FILE "{quoted}" AS contents\n' * 2000) + 'SAY contents\n', encoding="utf-8")
|
||||
binary = tmp_path / "claro-asan"
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -21,7 +21,7 @@ def main() -> int:
|
||||
encoding="utf-8",
|
||||
)
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -18,7 +18,7 @@ def main() -> int:
|
||||
script = tmp_path / "run_command_expressions.claro"
|
||||
script.write_text('RUN COMMAND "true" AS output\n' * 2000, encoding="utf-8")
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ def main() -> int:
|
||||
with tempfile.TemporaryDirectory(prefix="runtime-error-cleanup-") as tmp:
|
||||
binary = Path(tmp) / "claro-asan"
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ def main() -> int:
|
||||
script = tmp_path / "typecheck.claro"
|
||||
script.write_text("SET known TO 1\n" + "SAY known\n" * 2000, encoding="utf-8")
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined",
|
||||
"src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
|
||||
@@ -43,4 +43,4 @@ with tempfile.TemporaryDirectory() as td:
|
||||
run([str(local), "package", "remove", "text"], cwd=proj)
|
||||
run([str(local), "run"], cwd=proj)
|
||||
|
||||
print("Validation passed. Claro v2026.10.20.155641 networking reliability is ready for use.")
|
||||
print("Validation passed. Claro v2026.10.20.160950 networking reliability is ready for use.")
|
||||
|
||||
@@ -23,10 +23,10 @@ def compiler_cmd():
|
||||
env_cc = os.environ.get("CLARO_CC")
|
||||
if env_cc:
|
||||
parts = env_cc.split()
|
||||
return parts + ["-std=c99", "src/claro.c", "-O0", "-o", str(EXE), "-lm"]
|
||||
return parts + ["-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "src/claro.c", "-O0", "-o", str(EXE), "-lm"]
|
||||
if ZIG_CC.exists():
|
||||
return [str(ZIG_CC), "cc", "-std=c99", "src/claro.c", "-O0", "-o", str(EXE), "-lm"]
|
||||
return ["gcc", "-std=c99", "src/claro.c", "-O0", "-o", str(EXE), "-lm"]
|
||||
return [str(ZIG_CC), "cc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "src/claro.c", "-O0", "-o", str(EXE), "-lm"]
|
||||
return ["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "src/claro.c", "-O0", "-o", str(EXE), "-lm"]
|
||||
|
||||
|
||||
def build():
|
||||
@@ -37,11 +37,13 @@ def build():
|
||||
|
||||
def main():
|
||||
build()
|
||||
run([sys.executable, "tools/validate_c89.py"])
|
||||
out = run([str(EXE), "--version"])
|
||||
if "Claro v2026.10.20.155641" not in out:
|
||||
if "Claro v2026.10.20.160950" not in out:
|
||||
raise SystemExit("Wrong version string")
|
||||
run([str(EXE), "test"])
|
||||
run([str(EXE), "validate"])
|
||||
run([sys.executable, "tools/validate_first_hour.py"])
|
||||
run([sys.executable, "tools/validate_ide_metadata.py"])
|
||||
run([sys.executable, "tools/validate_lsp_helper.py"])
|
||||
run([sys.executable, "tools/validate_concurrency.py"])
|
||||
@@ -55,7 +57,7 @@ def main():
|
||||
run([sys.executable, "tools/validate_write_file_expression_cleanup.py"])
|
||||
run([sys.executable, "tools/validate_version_convention.py"])
|
||||
run([str(EXE), "examples/networking.claro"])
|
||||
print("v2026.10.20.155641 validation complete")
|
||||
print("v2026.10.20.160950 validation complete")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -7,7 +7,7 @@ from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
EXE = ROOT / "claro.exe"
|
||||
EXPECTED = "Claro v2026.10.20.155641"
|
||||
EXPECTED = "Claro v2026.10.20.160950"
|
||||
|
||||
|
||||
def fail(message):
|
||||
@@ -31,12 +31,12 @@ def main():
|
||||
if ide.returncode != 0:
|
||||
fail(ide.stdout)
|
||||
metadata = json.loads(ide.stdout)
|
||||
if metadata.get("version") != "v2026.10.20.155641":
|
||||
fail(f"Expected IDE metadata version 'v2026.10.20.155641', got {metadata.get('version')!r}")
|
||||
if metadata.get("version") != "v2026.10.20.160950":
|
||||
fail(f"Expected IDE metadata version 'v2026.10.20.160950', got {metadata.get('version')!r}")
|
||||
validator = ROOT / "tools" / "validate_v1_17.py"
|
||||
text = validator.read_text(encoding="utf-8")
|
||||
if "Claro v2026.10.20.155641" not in text:
|
||||
fail("tools/validate_v1_17.py must validate Claro v2026.10.20.155641")
|
||||
if "Claro v2026.10.20.160950" not in text:
|
||||
fail("tools/validate_v1_17.py must validate Claro v2026.10.20.160950")
|
||||
print("Version convention validation OK")
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ def main() -> int:
|
||||
script.write_text((f'WRITE FILE "{path}" WITH "hello"\n' * 2000), encoding="utf-8")
|
||||
binary = tmp_path / "claro-asan"
|
||||
build = subprocess.run(
|
||||
["gcc", "-std=c99", "-O0", "-g", "-fsanitize=address,undefined", "src/claro.c", "-o", str(binary), "-lm"],
|
||||
["gcc", "-std=c89", "-pedantic-errors", "-Werror=implicit-function-declaration", "-O0", "-g", "-fsanitize=address,undefined", "src/claro.c", "-o", str(binary), "-lm"],
|
||||
cwd=ROOT, text=True, capture_output=True,
|
||||
)
|
||||
if build.returncode:
|
||||
|
||||
Reference in New Issue
Block a user