Scallop CLI
The Scallop toolchain provides command-line tools for working with Scallop programs. These tools enable you to run programs, experiment interactively, and compile Scallop code.
Available Tools
Scallop includes three main command-line tools:
scli - Scallop Interpreter
The primary tool for running Scallop programs from .scl files.
scli program.scl
Use cases:
- Execute Scallop programs
- Test and debug logic
- Run with different provenances
- Query specific relations
sclrepl - Interactive REPL
An interactive Read-Eval-Print-Loop for experimenting with Scallop.
sclrepl
Use cases:
- Interactive exploration
- Quick prototyping
- Learning Scallop syntax
- Testing small programs
sclc - Scallop Compiler
Compiles Scallop programs (future feature).
sclc program.scl
Use cases:
- Compile to standalone executables
- Optimize performance
- Generate intermediate representations
Installation
From Binary Releases
Download prebuilt binaries from the GitHub releases page:
# Download and extract
tar -xzf scallop-<version>-<platform>.tar.gz
# Move to PATH
sudo mv scli sclrepl sclc /usr/local/bin/
From Source
Build from source using Cargo:
# Clone repository
git clone https://github.com/scallop-lang/scallop.git
cd scallop
# Build release binaries
cargo build --release
# Binaries in target/release/
./target/release/scli --version
Verify Installation
scli --version
# Output: scli 0.2.5
Quick Start
Running Your First Program
Create a file hello.scl:
rel greeting = {"Hello", "Bonjour", "Hola"}
rel target = {"World", "Monde", "Mundo"}
rel message(g, t) = greeting(g), target(t)
query message
Run it:
scli hello.scl
Output:
message: {("Hello", "World"), ("Hello", "Monde"), ...}
With Probabilistic Reasoning
Create prob_example.scl:
rel 0.9::reliable_edge(0, 1)
rel 0.8::reliable_edge(1, 2)
rel path(a, b) = reliable_edge(a, b)
rel path(a, c) = path(a, b), reliable_edge(b, c)
query path
Run with provenance:
scli --provenance minmaxprob prob_example.scl
Output:
path: {0.9::(0, 1), 0.8::(1, 2), 0.8::(0, 2)}
Common Workflows
Development Workflow
- Write - Create
.sclfile - Test - Run with
scli - Debug - Add
--debugflags - Iterate - Modify and re-run
Experimentation Workflow
- Explore - Use
sclreplfor quick tests - Prototype - Develop logic interactively
- Save - Export to
.sclfile - Run - Execute with
scli
Production Workflow
- Develop - Write and test programs
- Integrate - Use Python API (scallopy)
- Deploy - Embed in applications
- Monitor - Use debug flags if needed
Summary
- Three tools:
scli(interpreter),sclrepl(REPL),sclc(compiler) - scli is the main tool for running
.sclprograms - sclrepl provides interactive exploration
- sclc compiles programs (future)
- Install from releases or build from source
For detailed usage:
- scli Documentation - Interpreter options and flags
- sclrepl Documentation - Interactive REPL guide
- sclc Documentation - Compiler usage