-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change parser package used #10
Comments
Can this be of help? https://github.com/OpenModelica/OMParser.jl together with the only effort I know to parse directly to MTK https://github.com/JKRT/OMBackend.jl/blob/master/src/CodeGeneration/MTK_CodeGeneration.jl |
I wouldn't use that, I'd directly use a BaseModelica parser since BaseModelica is much simpler than the full Modelica. |
Thanks, I might be able to get some use out of those. But yeah, full Modelica has several things that aren't valid in Base Modelica, which is supposed to make it simpler. So certain valid Modelica models should not parse as valid Base Modelica models. |
Automa.jl seems great for files that hold data, but I'm not sure it's the right tool for this. The way the parser is set up now means that there's a huge block of regex that's difficult to think about and difficult to change. It also can only handle a very small subset of the Base Modelica specification.
Ideally we would be using the Base Modelica ANTLR grammar with ANTLR to generate a parser that could handle everything in the specification. However ANTLR does not support Julia code generation.
There are a couple of alternatives I've been looking in to:
CombinedParsers.jl
This one has support for generating parsers from an EBNF grammar, which is similar to the grammar specification. However it hasn't been updated in 3 years and seems to not be working on Julia 1.10.
ParserCombinator.jl
This seems to be the one that most people use, and has been the most "maintained". Does not support
PikaParser.jl
Seems very simple to use, is a more recent package. Does not seem to support regex in matching, unless there's a work around. Would need to "translate" grammar in to something PikaParser understands.
Lerche.jl
A port of the Python Lark parser generator. Can take Lark grammars and generate a parser. Would need to create a Lark grammar from the ANTLR grammar.
ANTLR C++ / Python Code
Of course another option is to use ANTLR to generate C++ or Python code from the grammar for the parser and use it in this package. Not my favorite option, but definitely has some advantages.
The text was updated successfully, but these errors were encountered: