Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

A functional, content-addressable programming language.

License

NotificationsYou must be signed in to change notification settings

tekknolagi/scrapscript

Repository files navigation

Seescrapscript.org for some more information. Keepin mind that the syntax on the website will change a little bit in the comingweeks to match this repository.

Take a look insidescrapscript.py and all of its tests to getan idea for how the language works.

Usage

We support python3.8+.

# With a filepython3 scrapscript.pyeval examples/0_home/factorial.scrap# With a string literalpython3 scrapscript.py apply"1 + 2"# With a REPLpython3 scrapscript.py repl

or withCosmopolitan:

./util/build-com# With a file./scrapscript.comeval 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 prefixwithsh)

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:trunkeval /mnt/examples/0_home/factorial.scrap# With a string literaldocker run -i -t ghcr.io/tekknolagi/scrapscript:trunk apply"1 + 2"# With a REPLdocker 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

Usinguv

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

uv run python scrapscript_tests.py

[8]ページ先頭

©2009-2025 Movatter.jp