pyparsing parser for MiniZinc

20 views
Skip to first unread message

Paul Chisholm

unread,
May 4, 2026, 12:56:10 AM (6 days ago) May 4
to MiniZinc
Maybe a bit off topic, but in case anyone is interested, I have put together a MiniZinc parser using the Python pyparsing framework. See


Erik

unread,
May 4, 2026, 3:58:50 PM (5 days ago) May 4
to MiniZinc
Nice! I've been involved in something similar in the past (closed source) where we used a lark parser to inline and generate cross-reference of MiniZinc model files and documentation written in .rst.

Keeping it up to date with newer syntax and getting to work with more "advanced" syntax was challenging

You may be interested in this issue/discussion:

Jip Dekker

unread,
May 4, 2026, 6:48:45 PM (5 days ago) May 4
to MiniZinc
As an alternative, I'll note that we have a tree-sitter parser for MiniZinc: https://github.com/shackle-rs/shackle/tree/develop/parsers/tree-sitter-minizinc

A big selling point for us is that it is supposed to work for a whole range of languages, including Python.

Paul Chisholm

unread,
May 4, 2026, 9:19:22 PM (5 days ago) May 4
to MiniZinc
Nice, I wasn't aware of tree-sitter. I'll have to take a closer look, but one question. I note in the MiniZinc tree-sitter parser there are both grammar.json and grammar.js files, and to some extent they seem to cover the same ground. What is the different purpose of each?

Jip Dekker

unread,
May 6, 2026, 1:57:39 AM (3 days ago) May 6
to MiniZinc
The grammar.json is one of the generated files. The linked directory in the repository follows the standard tree-sitter structure. Their website should have the information about how to use the tree sitter grammar for you purpose: https://tree-sitter.github.io/tree-sitter/
Reply all
Reply to author
Forward
0 new messages