Are there any Isabelle/Isar languages parsers available? Specifically one that will parse the syntax and output something useful, ideally in a language-agnostic format such as JSON. I would like to basically have a JSON representation of an Isabelle/Isar .thy
file.
Asked
Active
Viewed 187 times
4

Lance
- 75,200
- 93
- 289
- 503
-
What information do you need from the AST? The `isabelle dump` tool gives you some structure and definition information in an Xml like format, but it is not really an AST. – Peter Zeller Oct 02 '20 at 11:40
-
I want to try and build a transpiler to JavaScript, so having some sort of pseudo-ast is all I really need. Some structured form of the source code. – Lance Oct 02 '20 at 21:15
-
In that case, I would look at the code generator for one of the existing languages (e.g. `src/Tools/Code/code_scala.ML`), and use this as the template for a JS code generator. – Peter Zeller Oct 03 '20 at 09:25
-
Huh, what'a a question! Isabelle user discussions contain some themes about this and Makarius has said that such parsing is highly non-trivial task, if it is possible at all. But, from the other side, there is https://dominique-unruh.github.io/scala-isabelle/ which I have started to used for parsing and I managed to ignite it. Though I moved on to other projects. Isablle is not onw grammar, there is possible to define additional grammar rules, extend grammar and that is why there is no single grammar than can be used for ANTRL to generate parser. – TomR Nov 29 '22 at 14:05
-
Your question is as deep as it is topical. Indeed, if one is able to parse and construct back isablle expressions, then one can enmebed them into neural networks and use for all kind of AI processing - automatic theorem proving, automatic theorem and concept generation, etc. All the used cases that involve natural language translation into HOL and subsequent processing and translating back. Essentially, your questsion is the holy grail. – TomR Nov 29 '22 at 14:07