Skip to content

Phase 1: language v2 (spec, lexer, parser, canons, validator) - #3

Merged
JFrusher merged 2 commits into
phase-0-foundationfrom
phase-1-language
Oct 24, 2026
Merged

JFrusher merged 2 commits into
phase-0-foundationfrom
phase-1-language

Conversation

@JFrusher

Copy link
Copy Markdown
Owner

Stacked on #2. Implements Phase 1 of ROADMAP.md.

  • M1.1 docs/spec/language.md: EBNF for the whole language: arguments, imports, axioms (scripture/source/principle), definitions, nodes, objections/replies, Fitch-style proofs, and formulas covering propositional, first-order, S5 modal, property variables and λ (needed for Gödel).
  • M1.2 Lexer with spans (code-point columns) and diagnostics rendered as file:line:col with a caret line.
  • M1.3 Recursive-descent parser and a typed AST; formulas become an immutable expression tree with a canonical ASCII/Unicode printer that re-parses to the same structure.
  • M1.4 Canon registry: Protestant 66, Catholic 73, Orthodox 77 books with chapter counts; Quran ayah bounds (6,236 total).
  • M1.5 Validator v2: name kinds, node rules, cycles, grounding and relevance warnings, scripture resolution. Both examples ported and passing; resurrection now states its inference-to-the-best-explanation premise explicitly and includes an objection and reply.
  • Mermaid exporter v2, CLI check / export --format mermaid, golden tests (THEOS_UPDATE_GOLDEN=1).

Changes from the plan (recorded in the roadmap):

  • Formulas are fully parsed in this phase, because the parser has to know where a formula ends.
  • The v1 binary format was removed here because it depended on the old AST. v2 arrives in Phase 2.
  • Clang CI builds against libc++, because libstdc++ 13 hides std::expected from Clang 18 (reproduced locally).

Local: GCC 13 and Clang 18 + libc++, 32 test cases pass.


Generated by Claude Code

- docs/spec/language.md: EBNF grammar for arguments, axioms, definitions,
  nodes, objections/replies, natural-deduction proofs and formulas
  (propositional, first-order, modal, property variables and lambda)
- Lexer with code-point columns; diagnostics rendered as file:line:col with
  a caret line
- Recursive-descent parser producing a typed AST; formulas parsed to an
  immutable expression tree with a canonical ASCII/Unicode printer
- Canon registry: Protestant (66), Catholic (73), Orthodox (77) books with
  chapter counts; Quran surah/ayah bounds
- Validator v2: name kinds, node-kind rules, cycles, grounding and
  relevance warnings, scripture resolution
- Mermaid exporter v2 with axioms, formulas, objections and replies
- CLI: theosc check / theosc export --format mermaid
- Examples ported; resurrection now states its inference-to-the-best-
  explanation premise explicitly and carries an objection and reply
- Golden tests (THEOS_UPDATE_GOLDEN=1 to refresh); Clang CI uses libc++
- v1 binary format removed (replaced by .theos v2 in Phase 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019WEmxyo9CRKSbjbEdCuJTG
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 52581d2e-a145-4152-b403-d26e27cee014
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Windows CI checked the golden .theo files out with CRLF; the renderer
copied the trailing \r into the excerpt line, so output differed from the
LF golden files. Strip it in the renderer (CRLF sources are normal on
Windows) and pin text files to LF with .gitattributes so golden
comparisons are byte-identical on every platform; .theos is binary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019WEmxyo9CRKSbjbEdCuJTG
@JFrusher
JFrusher marked this pull request as ready for review October 24, 2026 23:21
@JFrusher
JFrusher merged commit b9adbf8 into phase-0-foundation Oct 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants