#!/usr/bin/env bash
# Engine A runner: runs the Souffle-LintQ analyses in engine/lintq.dl over the
# extractor's 7-relation facts (extractor/facts/*.facts) and writes the
# Warn*.csv diagnostics into ./out.
#
# Souffle 2.5 REQUIRES the -D output directory to pre-exist, so we create it
# first. (Running `souffle -F facts -D out engine/lintq.dl` from the project
# root would FAIL: the top-level facts/ holds the *rules* engine's Op/ActsOn/
# Succ facts, not the extractor's Stmt/GateOp/MeasureOp/... facts.)
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"

mkdir -p out
souffle -F ../extractor/facts -D out lintq.dl
