Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Scallop Interpreter (scli)

scli is the Scallop interpreter for running Scallop programs from .scl files. It supports probabilistic reasoning, debugging, and query execution.

Basic Usage

scli <input-file>

Example:

scli program.scl

Options

Provenance Configuration

--provenance / -p - Set the provenance type

scli --provenance minmaxprob program.scl
scli -p topkproofs program.scl

Available provenances: unit, proofs, minmaxprob, addmultprob, topkproofs, probproofs, etc.

Default: unit (discrete DataLog)

--top-k / -k - Set K value for top-K provenances

scli --provenance topkproofs --top-k 5 program.scl
scli -p topkproofs -k 10 program.scl

Default: 3

Query Options

--query / -q - Query a specific relation

scli --query path program.scl

Without this flag, all query declarations in the file are executed.

--output-all - Output all relations (including hidden ones)

scli --output-all program.scl

Execution Control

--iter-limit - Set iteration limit for recursion

scli --iter-limit 100 program.scl

Useful for preventing infinite loops in recursive programs.

--stop-at-goal - Stop when goal relation is derived

scli --stop-at-goal program.scl

Terminates execution as soon as the goal relation has facts.

--no-early-discard - Disable early discarding

scli --no-early-discard program.scl

Keeps all intermediate results instead of discarding low-probability facts.

Optimization Options

--do-not-remove-unused-relations - Keep unused relations

scli --do-not-remove-unused-relations program.scl

By default, relations not used in queries are removed for efficiency.

--wmc-with-disjunctions - Use WMC for disjunctions

scli --wmc-with-disjunctions program.scl

Enables weighted model counting with disjunctive facts for better probability computation.

--scheduler - Set execution scheduler

scli --scheduler <scheduler-type> program.scl

Controls execution order of rules.

Debugging Options

--debug / -d - Enable general debugging

scli --debug program.scl

Prints execution information and intermediate states.

--debug-front - Debug front-end IR

scli --debug-front program.scl

Shows intermediate representation after parsing.

--debug-back - Debug back-end IR

scli --debug-back program.scl

Shows intermediate representation before execution.

--debug-ram - Debug RAM program

scli --debug-ram program.scl

Shows the compiled RAM (Relational Algebra Machine) program.

--debug-runtime - Monitor runtime execution

scli --debug-runtime program.scl

Prints detailed execution traces.

--debug-tag - Monitor tag propagation

scli --debug-tag program.scl

Shows how provenance tags propagate through execution.

Other Options

--version / -V - Print version

scli --version

--help / -h - Print help

scli --help

Examples

Basic Execution

# Run simple program
scli edge_path.scl

Probabilistic Reasoning

# Run with min-max probability
scli --provenance minmaxprob uncertain_graph.scl

# Run with top-K proofs
scli -p topkproofs -k 5 uncertain_graph.scl

Query Specific Relation

# Only output the 'result' relation
scli --query result computation.scl

Debugging

# Debug execution
scli --debug program.scl

# Monitor runtime with tag propagation
scli --debug-runtime --debug-tag program.scl

Performance Tuning

# Limit recursion depth
scli --iter-limit 50 recursive_program.scl

# Use WMC optimization
scli --wmc-with-disjunctions --provenance topkproofs program.scl

Common Patterns

Development

# Quick test
scli test.scl

# With debugging
scli --debug test.scl

Testing Different Provenances

# Compare results
scli --provenance unit program.scl
scli --provenance minmaxprob program.scl
scli --provenance topkproofs -k 5 program.scl

Production

# Optimized execution
scli --provenance topkproofs -k 10 \
     --wmc-with-disjunctions \
     --iter-limit 1000 \
     production.scl

Summary

  • Basic: scli program.scl
  • Provenance: -p <type> and -k <value>
  • Query: -q <relation> for specific output
  • Debug: --debug* flags for troubleshooting
  • Optimize: --iter-limit, --wmc-with-disjunctions
  • Version: scli --version (current: 0.2.5)

For more details: