Update README.md from Claro v1.17.26 zip
This commit is contained in:
@@ -1,113 +1,209 @@
|
|||||||
# Claro 1.0 - Release Candidate
|
# Claro v1.17.26
|
||||||
|
|
||||||
Beginner-friendly programming for everyone.
|
<img src="assets/Claro_Logo.jpg" alt="Claro logo" width="160">
|
||||||
|
|
||||||
Claro is a simple, readable programming language designed for:
|
Claro is a small, readable scripting language designed to help beginners — especially learners with learning disabilities — learn programming without being overwhelmed by punctuation-heavy syntax.
|
||||||
|
|
||||||
- new programmers
|
Claro stays plain-text first: simple enough to start with `SET name "Jon"`, but able to grow into stronger typed scripts, objects, packages, graphics, networking, and tooling over the v1 line.
|
||||||
- classrooms
|
|
||||||
- people with learning differences
|
|
||||||
|
|
||||||
It uses clear, English-style commands and friendly error messages so you can focus on learning and creating.
|
## Status
|
||||||
|
|
||||||
---
|
**Current release:** Claro v1.17.26
|
||||||
|
|
||||||
## Repository
|
Validated in this package:
|
||||||
|
|
||||||
https://codeberg.org/RayPals/Claro
|
```bash
|
||||||
|
./claro --version
|
||||||
|
# Claro v1.17.26
|
||||||
|
|
||||||
---
|
./claro test
|
||||||
|
# PASS: 0 failure(s)
|
||||||
|
|
||||||
## Features
|
./claro validate
|
||||||
|
# Validation passed. Claro v1.17.26 networking reliability is ready for use.
|
||||||
|
```
|
||||||
|
|
||||||
- Easy to read and write
|
## Beginner-first syntax
|
||||||
- English-like syntax
|
|
||||||
- Friendly error messages
|
|
||||||
- Simple loops and decisions
|
|
||||||
- Reusable functions (`TEACH`, `CALL`, `RETURN`)
|
|
||||||
- Beginner game objects (sprites)
|
|
||||||
- Classroom-safe mode
|
|
||||||
- Portable — no installation required
|
|
||||||
|
|
||||||
---
|
Claro accepts both the sentence-like style and the shorter simple style:
|
||||||
|
|
||||||
## Running Claro
|
```claro
|
||||||
|
SET name TO "Jon"
|
||||||
|
SET name "Jon"
|
||||||
|
SET city to "Edmonton"
|
||||||
|
|
||||||
Interactive mode:
|
ASK "What is your name?" name
|
||||||
|
SAY "Hello " + name
|
||||||
|
|
||||||
claro
|
IF name = "Jon"
|
||||||
|
SAY "Nice name!"
|
||||||
|
END
|
||||||
|
```
|
||||||
|
|
||||||
Run a program:
|
Older forms such as `ASK "Name?" AS name`, `ENDIF`, `DONE`, and `LEARNED` still work so older Claro examples do not break.
|
||||||
|
|
||||||
claro program.claro
|
## Simple functions
|
||||||
|
|
||||||
Classroom safe mode:
|
```claro
|
||||||
|
TEACH greet name
|
||||||
|
SAY "Hello " + name
|
||||||
|
END
|
||||||
|
|
||||||
claro --classroom program.claro
|
DO greet "Jon"
|
||||||
|
```
|
||||||
|
|
||||||
---
|
Older function syntax still works:
|
||||||
|
|
||||||
## Your First Program
|
```claro
|
||||||
|
TEACH greet TAKES name
|
||||||
Create a file called `hello.claro`
|
SAY "Hello " + name
|
||||||
|
|
||||||
SAY "Hello, world!"
|
|
||||||
|
|
||||||
Run it:
|
|
||||||
|
|
||||||
claro examples/hello.claro
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Core Commands
|
|
||||||
|
|
||||||
SAY — show output
|
|
||||||
ASK — get input
|
|
||||||
SET — store data
|
|
||||||
IF — make decisions
|
|
||||||
DO — repeat
|
|
||||||
WAIT — pause
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Functions with TEACH
|
|
||||||
|
|
||||||
TEACH add TAKES a, b
|
|
||||||
RETURN a + b
|
|
||||||
LEARNED
|
LEARNED
|
||||||
|
|
||||||
CALL add WITH 2, 3
|
CALL greet WITH "Jon"
|
||||||
SAY RESULT
|
```
|
||||||
|
|
||||||
---
|
## Objects and classes
|
||||||
|
|
||||||
## Sprites
|
Classes can have typed fields and simple methods.
|
||||||
|
|
||||||
CREATE SPRITE player
|
```claro
|
||||||
MOVE SPRITE player TO 10 5
|
CLASS Player
|
||||||
SHOW SPRITE player
|
HAS name TEXT
|
||||||
HIDE SPRITE player
|
HAS score NUMBER
|
||||||
|
|
||||||
---
|
TEACH show
|
||||||
|
SAY name
|
||||||
|
SAY score
|
||||||
|
END
|
||||||
|
|
||||||
## Building from Source
|
TEACH add points
|
||||||
|
SET score score + points
|
||||||
|
END
|
||||||
|
END
|
||||||
|
|
||||||
Linux / macOS:
|
NEW Player player
|
||||||
|
SET player.name "Jon"
|
||||||
|
SET player.score 10
|
||||||
|
|
||||||
gcc src/claro.c -O2 -o claro
|
DO player.show
|
||||||
|
DO player.add 5
|
||||||
|
SAY player.score
|
||||||
|
```
|
||||||
|
|
||||||
Windows (MinGW):
|
Object helper commands:
|
||||||
|
|
||||||
gcc src/claro.c -O2 -o claro.exe
|
```claro
|
||||||
|
OBJECT CLASS player AS kind
|
||||||
|
OBJECT FIELDS player AS fields
|
||||||
|
```
|
||||||
|
|
||||||
---
|
## Static type safety
|
||||||
|
|
||||||
## Contributing
|
Beginners can still write the simplest form:
|
||||||
|
|
||||||
https://codeberg.org/RayPals/Claro/issues
|
```claro
|
||||||
|
SET name "Jon"
|
||||||
|
```
|
||||||
|
|
||||||
---
|
When learners are ready, Claro can protect variables with plain-text types:
|
||||||
|
|
||||||
## License
|
```claro
|
||||||
|
SET score NUMBER 10
|
||||||
|
SET name TEXT "Jon"
|
||||||
|
SET ready YESNO YES
|
||||||
|
|
||||||
MIT
|
TYPE OF score AS kind
|
||||||
|
SAY kind
|
||||||
|
|
||||||
|
CHECK TYPE score IS NUMBER
|
||||||
|
```
|
||||||
|
|
||||||
|
## Project and package workflow
|
||||||
|
|
||||||
|
v1.17.26 hardens Claro's project/package workflow.
|
||||||
|
|
||||||
|
Create a starter project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claro new MyProject
|
||||||
|
cd MyProject
|
||||||
|
claro run
|
||||||
|
```
|
||||||
|
|
||||||
|
Manage packages:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claro package init
|
||||||
|
claro package add text
|
||||||
|
claro package add sdl
|
||||||
|
claro package list
|
||||||
|
claro package remove text
|
||||||
|
claro package doctor
|
||||||
|
claro package lock
|
||||||
|
```
|
||||||
|
|
||||||
|
Claro now creates and maintains:
|
||||||
|
|
||||||
|
```text
|
||||||
|
claro.project
|
||||||
|
claro.lock
|
||||||
|
packages/
|
||||||
|
```
|
||||||
|
|
||||||
|
Package names are checked so unsafe names such as `../bad` are rejected.
|
||||||
|
|
||||||
|
|
||||||
|
## Networking
|
||||||
|
|
||||||
|
v1.17.26 adds safer beginner networking commands with offline `claro://` test URLs.
|
||||||
|
|
||||||
|
```claro
|
||||||
|
HTTP CHECK "claro://hello" AS safe
|
||||||
|
SAY safe
|
||||||
|
|
||||||
|
HTTP GET "claro://hello" AS page STATUS status
|
||||||
|
SAY page
|
||||||
|
SAY status
|
||||||
|
|
||||||
|
HTTP SAVE "claro://json" TO "network_demo.json" AS saveStatus
|
||||||
|
SAY saveStatus
|
||||||
|
```
|
||||||
|
|
||||||
|
The latest HTTP status is also stored in `LASTHTTP`. Real `http://` and `https://` requests use `curl` when available, while `claro://` works offline for lessons and tests.
|
||||||
|
|
||||||
|
## Useful commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
claro help
|
||||||
|
claro --version
|
||||||
|
claro test
|
||||||
|
claro validate
|
||||||
|
claro doctor
|
||||||
|
claro examples
|
||||||
|
claro check examples/quiz.claro
|
||||||
|
claro typecheck examples/type_hardening.claro
|
||||||
|
claro fmt examples/quiz.claro
|
||||||
|
claro repl
|
||||||
|
claro new MyProject
|
||||||
|
claro run
|
||||||
|
claro package init
|
||||||
|
claro package add text
|
||||||
|
claro package list
|
||||||
|
claro package doctor
|
||||||
|
claro ide
|
||||||
|
```
|
||||||
|
|
||||||
|
## Good first scripts
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./claro lessons/01_hello.claro
|
||||||
|
./claro examples/quiz.claro
|
||||||
|
./claro examples/simple_functions.claro
|
||||||
|
./claro examples/objects_classes.claro
|
||||||
|
./claro examples/text_polish.claro
|
||||||
|
./claro examples/networking.claro
|
||||||
|
```
|
||||||
|
|
||||||
|
## Release direction
|
||||||
|
|
||||||
|
Claro should remain in the `v1.xx.yy` line for normal development. A future Claro v2 should mean a full rewrite years later, not an ordinary feature update.
|
||||||
|
|||||||
Reference in New Issue
Block a user