Run artifact

workspace/targets/jq/blueprint/ARCHITECTURE.md

ARCHITECTURE: jq Interpreter

FieldValue
Version20261028 V1
DescriptionDefines the Python interpreter foundation and its shared execution boundaries.
ProvidesPython application foundation

Structure and contracts

The application is a standalone Python interpreter. The root executable jq ultimately delegates argument handling and JSON input and output to the interpreter. Establish the package jq_interpreter with these shared interfaces:

detected before execution from errors raised during evaluation. The latter is an interpreter exception and need not inherit from Python's built-in RuntimeError.

kind, value, line, and column.

tree or raises CompileError.

It must not eagerly consume the result stream. Lexical environments carry bindings and function definitions without mutating an enclosing scope.

point maps compile and runtime errors to their distinct exit statuses.

The foundation establishes the package and error interfaces; subsequent stories implement the lexer, parser, evaluator, builtins, and executable. An evaluator may yield values before raising RuntimeError; callers must retain those values.

Boundary ownership

BoundaryOwnerAllowed low-level access
Source text and tokenizationLexerPython text and Unicode facilities
Grammar and static validationParserLexer token stream
Evaluation and lexical scopeEvaluatorAST, environments, and builtin interfaces
BuiltinsBuiltin modulesPython standard library and evaluator interfaces
Command input and outputCommand entry pointStandard input, output, error, and process arguments
Persistence and external servicesNoneNo persistent store or external service is required

Technology Stack

Python 3.11 or newer provides the interpreter and its standard-library runtime. POSIX shell runs the supplied scoring entry point. No package installation or network access is required.

Programmatic Acceptance

=== AC foundation-errors ===
Intent: The foundation exposes separate compile and runtime exception contracts for later interpreter stages.

from jq_interpreter.errors import CompileError, RuntimeError as JqRuntimeError

assert issubclass(CompileError, Exception) assert issubclass(JqRuntimeError, Exception) assert CompileError is not JqRuntimeError assert not issubclass(CompileError, JqRuntimeError) assert not issubclass(JqRuntimeError, CompileError) === END AC foundation-errors ===

User Acceptance

Guardrails

the interfaces built on this foundation.