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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file scrapscript-0.1.1.tar.gz.

File metadata

  • Download URL: scrapscript-0.1.1.tar.gz
  • Upload date:
  • Size: 29.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.19.0-38-generic

File hashes

Hashes for scrapscript-0.1.1.tar.gz
Algorithm Hash digest
SHA256 29978d947617968b6031a39a9d8d3c7ee19267b5d0e97261d9844238675327b1
MD5 a4e02f747f50396f7ed892b69709280e
BLAKE2b-256 76556e63fbb418055baf34aed4cddf90634a81cdf4b11ac312d620c6c7767899

See more details on using hashes here.

File details

Details for the file scrapscript-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: scrapscript-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/5.19.0-38-generic

File hashes

Hashes for scrapscript-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2a5da62aa2700edcb479a1c17e22d38d5823ddae6a8dd1feaf56ba253d3b4527
MD5 f7e826c1ee8d07da15da5dd31d555821
BLAKE2b-256 e2e8ac8328947b1317be041aea5c82101984b803a464973476632c6c38b999b8

See more details on using hashes here.

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