Skip to content

Latest commit

 

History

History
45 lines (35 loc) · 1.76 KB

File metadata and controls

45 lines (35 loc) · 1.76 KB

AWK Target Implementation Status

Quick Links


Current Implementation ✅

  • Facts only: compiles Prolog facts into AWK associative arrays with deduplication and composite keys.
  • Infrastructure: module exists (awk_target.pl), integrates with recursive_compiler.pl, firewall hooks, options for separators/format/unique.
  • Output: self-contained AWK scripts (shebang, BEGIN block, lookup + dedup).

Example

person(alice).
person(bob).

BEGIN { facts["alice"]=1; facts["bob"]=1 }
{ key = $1; if (key in facts && !(key in seen)) { seen[key]=1; print $0 } }

Not Implemented Yet ❌

  • Streaming of rule bodies (single or multiple rules still TODO placeholders).
  • Recursion patterns (tail/linear/fold/tree/mutual/transitive closure).
  • Advanced features: CSV/JSONL ingestion, arithmetic/regex/string ops, inequality constraints beyond basic comparisons.

Feasibility Snapshot

  • Tail/linear recursion can be lowered to iterative loops/state in AWK (feasible).
  • Bounded unrolling for small joins/paths is plausible; unbounded mutual recursion is likely too costly.
  • Dedup and join emulation rely on associative arrays; performance depends on input size.

Roadmap / Next Steps

  1. Implement single-rule streaming compilation (joins, basic comparisons, dedup keying).
  2. Add multi-rule union handling with consistent key composition.
  3. Optional: bounded/iterative transitive closure for small graphs; simple tail recursion lowering.
  4. Extend input handling (CSV/JSONL) if needed, then add golden-file/integration tests for generated AWK.