Skip to content

refactor(Parsing): one sentence at a time, terms, and exercise complex-det - #62

Merged
arademaker merged 8 commits into
mainfrom
refactor/parsing-terminology
Nov 19, 2026
Merged

arademaker merged 8 commits into
mainfrom
refactor/parsing-terminology

Conversation

@arademaker

@arademaker arademaker commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Terminology, scope and consistency fixes in Parsing, from a review of 9.1–9.6, plus exercise 9.10.

  • One sentence at a time (Parsing: texts parsed as conjunctions of sentences (CSwFP/9.5, 9.7) #57). The full stop has no lexicon entry (CSwFP gives it CONJ and parses a text as a conjunction of sentences). lexer takes one sentence; splitting a text into sentences is left to an outer segmentation step that the book does not define, and the full stop has no entry because preproc drops the only one. and keeps CONJ and joins clauses within a sentence. The rename of TXT to S for 9.7 is recorded in Parsing: texts parsed as conjunctions of sentences (CSwFP/9.5, 9.7) #57 and Parsing: write the sections from CSwFP/9.7–9.8 #49.
  • What the parser of 9.6 covers. The lexicon has CONJ, COND, THEN and REL entries, but the parser has only S → NP VP; the cues and the full text say so, and a prs example shows that a coordination of clauses has no parse.
  • PHON instead of ORTH, matching the field phon of Cat, and "AVM" throughout instead of the unexplained "matriz".
  • Terms. sentença, oração and sintagma replace "frase" across Parsing and in a few other chapters, and are added to the term list of STYLE-WRITING.md. They are introduced at the start of ParseTrees (terse cues and full text), citing Caseli and Nunes (2024), new in Bib.lean. S is the start symbol, for sentence, and is reused for clauses.
  • parseWith and exercise complex-det (CSwFP 9.10). prs is now parseWith lexicon parseSent: the parsers of the rules never consult the lexicon, so only this last step takes it. The exercise extends the lexicon with the missing determiner functions and with digit strings as NUM, adds DET → DF NUM, and is tested on noun phrases (Decide where the remaining CSwFP exercises go #53).
  • Prose fixes: the chapter opening (author's text), the case of one piece in splitN, scan inserting a space only before punctuation, the types of Parser merged into the paragraph on StateT, sections named by {ref} instead of "the next section", and GF described as a functional language for writing grammars.
  • The plan note of the chapter is dropped: DEVIATIONS.md records 9.1–9.6, and Parsing: write the sections from CSwFP/9.7–9.8 #49 tracks 9.7–9.8.

Closes #57; what is left of it for 9.7 is tracked in #49.

Related:

🤖 Generated with Claude Code

The full stop is no longer a CONJ: the grammar parses one sentence
at a time, and splitting a text into sentences is left to an outer
segmentation step. `and` keeps CONJ and joins clauses within a
sentence (#57).

Categories are shown with PHON instead of ORTH, the name of the
field phon, and "AVM" is used throughout instead of "matriz".

The terms sentença, oração and sintagma replace "frase", recorded in
the term list of STYLE-WRITING.md, and are introduced in a terse cue
at the start of ParseTrees, citing Caseli and Nunes (2024).

AI usage: Claude (Anthropic) drafted the changes; the author reviewed
and approved them.
Copilot AI balanced review requested due to automatic review settings November 19, 2026 02:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the sentence-level parsing and terminology updates.

No open issues 🎉

What changed in this PR

This PR clarifies sentence-level parsing in the Lean textbook and standardizes its linguistic terminology. It removes the full stop’s conjunction entry, leaving sentence segmentation to an external step as discussed in #57.

Changes:

  • Restricts parsing input to one sentence while retaining and as a clause conjunction.
  • Replaces ORTH with PHON in AVM displays and aligns Portuguese syntax terms.
  • Expands explanatory prose for features, the lexicon, and category parsers, and adds a parser example.
File Description
STYLE-WRITING.md Records the preferred translations for sentence, clause, and phrase.
DEVIATIONS.md Documents sentence-level scope and the PHON display convention.
CSwL/​Parsing/​Recognition.lean Uses “sentenças” for grammar-generated sentences.
CSwL/​Parsing/​ParseTrees.lean Introduces syntax terms and explains the reuse of S for clauses.
CSwL/​Parsing/​Lexicon.lean Removes the full-stop entry and expands lexical-processing explanations.
CSwL/​Parsing/​Features.lean Uses PHON in category displays and explains feature agreement.
CSwL/​Parsing/​Combinators.lean Adds a parseAs noun-phrase example.
CSwL/​Parsing/​Categories.lean Updates tree displays to PHON and expands parser explanations.
CSwL/​ModelChecking.lean Aligns sentence terminology in prose.
CSwL/​Logic/​FOL.lean Uses “sentença” in the introductory example.
CSwL/​Composition/​Quantification.lean Aligns sentence terminology in quantification prose.
Bib.lean Adds the Caseli and Nunes reference for syntax terminology.

Review effort: Balanced

The lexicon has CONJ, COND, THEN and REL entries, but the parser of
Categories has only S → NP VP. The terse cues and the full text say
so, and a prs example shows that a coordination of clauses has no
parse.

AI usage: Claude (Anthropic) drafted the changes; the author reviewed
and approved them.
Explain the case of one piece in splitN. In Lexicon, explain once,
next to lexer, that the input is a single sentence, and derive from
preproc why the full stop has no lexicon entry; say that scan inserts
a space only before punctuation. Merge the paragraph on the types of
Parser into the one that presents StateT.

AI usage: Claude (Anthropic) drafted the changes; the author reviewed
and approved them.
The opening of the chapter summarizes its path, from parse trees and
the palindrome grammar to parsers over categories with features and
AVMs. In ParseTrees, the full text presents sentença, oração,
sintagma and constituinte, and S as the label of both.
The plan repeated what DEVIATIONS.md records for 9.1–9.6, and what
issue #49 tracks for 9.7–9.8.

AI usage: Claude (Anthropic) drafted the change; the author approved
it.
prs is now parseWith lexicon parseSent: parseWith takes the lexicon
and the parser, since the parsers of the rules never consult the
lexicon. With it, exercise complex-det (CSwFP 9.10) extends the
lexicon with the missing determiner functions and numerals and adds
the rule DET → DF NUM, tested on noun phrases.

AI usage: Claude (Anthropic) drafted the changes; the author reviewed
and approved them.
AI usage: Claude (Anthropic) drafted the change; the author approved
it.
…opening

Name the section of the parser of categories instead of "the next
section". In the further reading, GF is described as a functional
language specialized in writing grammars: it is not a language like
Haskell, only functional like it. In the opening, the lexical analysis
prepares the input sentence for the lookup in the lexicon.

AI usage: Claude (Anthropic) drafted the changes; the author reviewed
and approved them.
@arademaker arademaker changed the title refactor(Parsing): parse one sentence at a time, and fix the terms refactor(Parsing): one sentence at a time, terms, and exercise complex-det Nov 19, 2026
@arademaker
arademaker merged commit 7a86220 into main Nov 19, 2026
1 check passed
@arademaker
arademaker deleted the refactor/parsing-terminology branch November 19, 2026 03:25
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.

Parsing: texts parsed as conjunctions of sentences (CSwFP/9.5, 9.7)

2 participants