Skip to content

Parser and AST (@signalql/parser) ​

The @signalql/parser package exposes:

  • parse(query: string) → Query
  • tokenize(query: string) for tokenizer debugging
  • ParseError for structured failures

Implementation lives in @signalql/compiler; the standalone parser package gives downstream tools a stable import surface without pulling codegen unless needed.

Stability expectations ​

  • AST node kinds span every spec version — v0.1 (count, funnel), v0.2 (retrieve, sequence), v0.3 (retrieve_v03, funnel_v03, describe, watch), v0.4 (graph, reachability, path, trace, context), and v0.5 (get_object, show_revisions, show_representations, get_representation, find_object, find_dependents, trace_object, context_task, explain_context, show_object_types, show_capabilities) — and align with schemas/signalql-ast-v0.5.schema.json (current).
  • Keywords are contextual (v0.5): a keyword in a name position — entity type, relationship, field — is a name, so entity(metric) and -[contains]-> parse. v0.5 adds no reserved words.
  • Breaking AST changes require a spec minor/major bump and schema revision.

Tests ​

See packages/parser/test/parser.test.ts and packages/compiler/test/compile.test.ts.