Skip to main content

Scrapscript interpreter

Project description

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)

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

Running Tests

python3 scrapscript.py test

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scrapscript-0.1.1.tar.gz (29.0 kB view hashes)

Uploaded Source

Built Distribution

scrapscript-0.1.1-py3-none-any.whl (29.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page