[P1] Add Project file/language facts and Tree-sitter grammar registry #95
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
nsaspy/prolog-rlm#95
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent: #93
Depends on: #94
Goal
Define the Prolog-side mapping from Project -> File -> Language -> parser backend -> Tree-sitter grammar so arbitrary compatible grammars can be registered without modifying the C FFI.
This issue owns the declarative Project/source registry, not CST traversal or semantic extraction.
Required Project/file facts
Provide normalized facts/API equivalent in semantics to:
A file must have an identity distinct from its path so later facts can refer to one versioned source artifact without encoding everything into one compound term.
Support at least:
Tree-sitter grammar registry
Provide a Prolog registry equivalent to:
Exact representation may differ. The registry must remain declarative and inspectable.
Required operations should include semantics equivalent to:
Loading/registering a grammar does not grant filesystem/process/network/tool authority.
Language detection
Represent detection evidence explicitly rather than hiding it in an irreversible imperative guess.
Support evidence forms equivalent to:
The first implementation may use extensions/shebangs plus explicit overrides. Preserve enough structure so stronger detectors can be added without rewriting the file model.
Define deterministic resolution for:
Do not silently treat
unknownandunsupportedas the same state.Parser backend selection
Tree-sitter is one backend, not the ontology itself.
Support facts equivalent to:
Do not route authoritative Prolog semantic parsing through Tree-sitter merely for symmetry. A later SWI-native analyzer may provide stronger Prolog facts while Tree-sitter remains optionally available for editor-style syntax observations.
Version/provenance
Grammar registration and parse selection must expose enough metadata to later prove which parser produced an observation:
Do not make raw filesystem library paths the sole durable grammar identity.
Acceptance criteria
parser_for_file/2can select Tree-sitter or another backend such asswi_native.Non-goals
Refs #93 #94 #75