Skip to content
Projets

À propos

Un langage de programmation fonctionnel et adressé par contenu.

Langages et environnements d’exécution

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

Scrapscript Interpreter

See scrapscript.org for some more information. Keep in mind that the syntax on the website will change a little bit in the coming weeks to match this repository.

Take a look inside scrapscript.py and all of its tests to get an idea for how the language works.

Usage

We support python3.8+.

# With a file
python3 scrapscript.py eval examples/0_home/factorial.scrap

# With a string literal
python3 scrapscript.py apply "1 + 2"

# With a REPL
python3 scrapscript.py repl

or with Cosmopolitan:

./util/build-com

# With a file
./scrapscript.com eval examples/0_home/factorial.scrap

# With a string literal
./scrapscript.com apply "1 + 2"

# With a REPL
./scrapscript.com repl

(if you have an exec format error and use Zsh, either upgrade Zsh or prefix with sh)

or with Docker:

# With a file (mount your local directory)
docker run --mount type=bind,source="$(pwd)",target=/mnt -i -t ghcr.io/tekknolagi/scrapscript:trunk eval /mnt/examples/0_home/factorial.scrap

# With a string literal
docker run -i -t ghcr.io/tekknolagi/scrapscript:trunk apply "1 + 2"

# With a REPL
docker run -i -t ghcr.io/tekknolagi/scrapscript:trunk repl

The experimental compiler:

Normal ELF

./scrapscript.py compile some.scrap  # produces output.c
./scrapscript.py compile some.scrap --compile  # produces a.out

Cosmopolitan

CC=~/Downloads/cosmos/bin/cosmocc ./scrapscript.py compile some.scrap  --compile # produces a.out

Wasm

CC=/opt/wasi-sdk/bin/clang \
CFLAGS=-D_WASI_EMULATED_MMAN \
LDFLAGS=-lwasi-emulated-mman \
./scrapscript.py compile some.scrap --compile  # produces a.out

Development Workflow

Running Tests

python scrapscript_tests.py

Type Checking the Python Sources

mypy --strict scrapscript.py

Formatting the Python Sources

ruff format scrapscript.py

Checking for Format Errors

ruff check scrapscript.py

Using uv

If you choose to use uv to manage development dependencies, you can run any of the previous four commands by prefixing them with uv run, e.g.:

uv run python scrapscript_tests.py

Explorer des projets similaires

Chargement…