Skip to content

Menhir parser#1295

Draft
jonludlam wants to merge 151 commits intoocaml:masterfrom
jonludlam:menhir-parser
Draft

Menhir parser#1295
jonludlam wants to merge 151 commits intoocaml:masterfrom
jonludlam:menhir-parser

Conversation

@jonludlam
Copy link
Member

This is @FayCarson's work.

There are still some fixes that need to be made. See src/parser/TODO.md for a list.

Add `nestable_block_element` to main, making for 2/3 top level rules
done
@jonludlam jonludlam marked this pull request as draft January 27, 2025 16:27
jonnyfiveisonline pushed a commit to jonnyfiveisonline/odoc that referenced this pull request Feb 13, 2026
Squash-merge of FayCarsons' menhir parser work (PR ocaml#1295) onto current
master. The hand-written recursive descent parser (syntax.ml) is replaced
by a menhir grammar (parser.mly) with supporting modules.

Key changes:
- Replace syntax.ml with parser.mly (menhir grammar)
- Add tokens.ml (external token definitions for menhir)
- Add parser_aux.ml (parser action helpers)
- Add writer.ml (writer monad for warning collection)
- Rewrite lexer.mll to emit menhir-compatible tokens
- Update odoc_parser.ml entry point to use Parser.main
- Add menhirLib dependency to dune and opam
- Preserve master's code block box model (deindent/codeblock_content)
- Preserve master's new tags (@children_order, @toc_status, etc.)
- Update serialize.ml for current AST types
- Add test_driver/tester.ml for parser comparison testing

Note: expect tests have known behavioral differences from the old parser
(different error messages, locations). These are documented in TODO.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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