Skip to content

tekknolagi/scrapscript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

6d82915 · Jan 10, 2024
Jan 7, 2024
Dec 21, 2023
Dec 10, 2023
Dec 7, 2023
Nov 29, 2023
Dec 21, 2023
Jan 5, 2024
Dec 11, 2023
Jan 5, 2024
Jan 5, 2024
Jan 5, 2024
Dec 7, 2023
Dec 7, 2023
Jan 5, 2024
Nov 22, 2023
Jan 10, 2024
Jan 5, 2024

Repository files navigation

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:

./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

Running Tests

python3 scrapscript.py test