idaholab / moose

Multiphysics Object Oriented Simulation Environment
https://www.mooseframework.org
GNU Lesser General Public License v2.1
1.71k stars 1.04k forks source link

Create MOOSE executable method for parsing input files. #8365

Closed aeslaughter closed 6 years ago

aeslaughter commented 7 years ago

Description

It would be advantageous to have a single method for parsing input files (i.e., remove the python parser). There should be a command for moose --parse-input that dumps the input file to a JSON data structure that can easily be read.

Rationale

Currently, the support syntax between the python parser and application parser are not the same. Rather than try to support two parsers, just use the parser in MOOSE.

Impact

This will affect Peacock and MooseDocs, but in a good way.

permcody commented 7 years ago

You guys aren't planning to go build a parser are you? I think the current plan is to get the parser from the Oakridge guys.

friedmud commented 7 years ago

We need to maintain our own Python capability for reading input files. It serves a TON of utility.

For one thing: it means that we can read input files without needing to have a run-able binary hanging around. There are a number of circumstances where we may not have access to an executable but want to read an input file (like, if we're running on a workstation but our binary is on a cluster, etc.).

On Mon, Jan 23, 2017 at 11:57 AM Cody Permann notifications@github.com wrote:

You guys aren't planning to go build a parser are you? I think the current plan is to get the parser from the Oakridge guys.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/idaholab/moose/issues/8365#issuecomment-274546819, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1JMQsvnwT0ebWzflPrzkBu66pDRXfGks5rVNvygaJpZM4LrR7Z .

aeslaughter commented 7 years ago

We can leave ParseGetPot for you to use, we need something more complete for what we are doing.

aeslaughter commented 7 years ago

@permcody We are not going to write one, we just want to use the same parser that MOOSE uses.

friedmud commented 7 years ago

I do think you're going to have more trouble getting GetPot (that MOOSE uses) to read the input file in a way that can generate JSON... it's doable, but it's going to take quite a bit of work.

That said: I'm not against that particular idea. I still fantasize sometimes about actually switching the MOOSE syntax over to JSON! It would simplify so many things. This could be a good first step: the ability to translate old input files into JSON!

On Mon, Jan 23, 2017 at 12:05 PM Andrew E Slaughter < notifications@github.com> wrote:

@permcody https://github.com/permcody We are not going to write one, we just want to use the same parser that MOOSE uses.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/idaholab/moose/issues/8365#issuecomment-274549527, or mute the thread https://github.com/notifications/unsubscribe-auth/AA1JMXvm1uirC7UrzjCrSO8y4OzAOlgTks5rVN30gaJpZM4LrR7Z .

aeslaughter commented 7 years ago

We shouldn't replace GetPot, writing JSON is not as clean as writing GetPot, in my opinion. I would be alright with supporting both.

permcody commented 7 years ago

@friedmud - we don't plan on doing any of this work. The Oakridge guys working on the NEAMS Workbench tasks have created a really good parser (far superior to either our Python parser or the GetPot parser). It uses flex/bison so it verifies the grammar, has semantic verification, and can provide useful error messages in malformed files. Since it's grammar based it should be adaptable to handle any syntax we want so talking about YAML vs JSON is not really relevant here.

If at all possible, I hope that we can make use of that parser without adding extra dependencies and I've conveyed that message to the Oakridge team on several occasions. I believe we should be getting access to that parser very soon and we can look at whether or not we can make use of it in the way that we require. fingers crossed

For the time being, lets let this ticket just sit until we have a chance to look at their work.

aeslaughter commented 7 years ago

The following should have syntax update to [Modules/tensor_mechanics/Master] when this issue is done:

permcody commented 7 years ago

We will drop the Getpot parser (not the syntax) hopefully sooner then later. Ideally we will have a true LALR1 parser which will make it easier to support several different syntaxes and make the parser much easier to understand and maintain. On Mon, Jan 30, 2017 at 9:00 AM Andrew E Slaughter notifications@github.com wrote:

The following should have syntax update to [Modules/tensor_mechanics/Master] when this issue is done:

- modules/tensor_mechanics/tests/finite_strain_elastic/elastic_rotation_test.i

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/idaholab/moose/issues/8365#issuecomment-276102033, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5XIPHQTNDYWZu7fyzQ1u5WsO_ihqJvks5rXgkcgaJpZM4LrR7Z .

brianmoose commented 7 years ago

We still use the python GetPot parser just to parse the tests files used by the test harness. It would probably be a bad idea to make the test harness depend on an executable being built.