Skip to content

Add additional extraction language in plugins - #22541

Open
vbergeron wants to merge 2 commits into
rocq-prover:masterfrom
vbergeron:extraction-external-languages
Open

vbergeron wants to merge 2 commits into
rocq-prover:masterfrom
vbergeron:extraction-external-languages

Conversation

@vbergeron

Copy link
Copy Markdown

Follow-up to #22487: allow plugins to add extraction languages.

  • Table.lang gets External of string; Extraction Language accepts any registered identifier.

  • Common.register_language registers a language_descr; built-in languages use it too.

  • Per-language special cases move to language_descr fields: unquote, upper_types, char_type, string_type, modular, id_of_filename.

  • error_scheme becomes error_not_modular, for any language, with a hint to use single-file extraction.

  • Added / updated test-suite.

  • Added changelog.

  • Added / updated documentation.

    • Documented any new / changed user messages.
    • Updated documented syntax by running make doc_gram_rsts.

@vbergeron
vbergeron requested review from a team as code owners September 29, 2026 08:11
@coqbot-app coqbot-app Bot added the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Sep 29, 2026
@vbergeron vbergeron changed the title Extraction external languages Add additional extraction language as a plugin Sep 29, 2026
@vbergeron vbergeron changed the title Add additional extraction language as a plugin Add additional extraction language in plugins Sep 29, 2026
Comment thread test-suite/misc/extraction-external-language.sh Outdated
@SkySkimmer SkySkimmer self-assigned this Sep 29, 2026
- `Table.lang` gets `External of string`; `Extraction Language` accepts
  any registered identifier.
- `Common.register_language` registers a `language_descr`; built-in
  languages use it too.
- Per-language special cases move to `language_descr` fields: `unquote`,
  `upper_types`, `char_type`, `string_type`, `modular`, `id_of_filename`.
- `error_scheme` becomes `error_not_modular`, for any language, with a
  hint to use single-file extraction.

Follow-up to rocq-prover#22487.
@vbergeron
vbergeron force-pushed the extraction-external-languages branch from 02f8881 to 98169b3 Compare September 29, 2026 08:29
Comment thread plugins/extraction/common.ml Outdated
Comment thread test-suite/misc/extraction-external-language.sh Outdated

@SkySkimmer SkySkimmer 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.

seems reasonable, if some other language needs more flexibility we can change the API later.

@SkySkimmer

Copy link
Copy Markdown
Contributor

Do you have scala as an external plugin to add to CI?

@vbergeron

Copy link
Copy Markdown
Author

Switched to CString.Map and to an expected output file, thanks.
The Scala plugin isn't published yet; I'll add it to CI in a follow-up PR once it is !

@SkySkimmer

Copy link
Copy Markdown
Contributor

@coqbot run full ci

@coqbot-app coqbot-app Bot removed the needs: full CI The latest GitLab pipeline that ran was a light CI. Say "@coqbot run full ci" to get a full CI. label Sep 30, 2026
@ppedrot

ppedrot commented Sep 30, 2026

Copy link
Copy Markdown
Member

Also, a naive question to @vbergeron: what were the limitations of the JSON export that prevented you from writing your code directly above it?

@vbergeron

Copy link
Copy Markdown
Author

Also, a naive question to @vbergeron: what were the limitations of the JSON export that prevented you from writing your code directly above it?
Hello !

The JSON export drops some information the proposed Scala backend relies on:

  • ind_kind: coinductives and records come out as plain decl:ind, so no laziness for coinductives and no field names for records
  • cofix and fix are both printed as decl:fixgroup
  • custom matches from Extract Inductive are ignored, and custom types with parameters are flattened to a name
  • the scrutinee type of match, which I use to drop unneeded casts.

An external translator would also have to redo the keyword/case renaming that Common already does without clashes.

Last but not least, the JSON backend is marked as for "development and debugging". Enriching and stabilizing the format seemed like a bigger commitment than a plugin API.

Happy to discuss it further if needed

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.

3 participants