You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Yes, I need to think about it. This is very low priority, I think we'll just remove it from fastGPT. I initially thought I would set more variables this way, but it looks like we'll just set them at the command line if needed.
Let's figure out how to represent namelists at the ASR level. It would be good to design them in such a way as to allow (later) to represent any user-defined custom readers/writers for other formats like JSON, TOML, NPY, HDF5, GGUF, etc.
It looks like the read(u, input_fastGPT) line will read a structure format from the textual input file. One way is to transform it to something like _lfortran_namelist_read(u, "A", A, "B", B, etc.), and it would populate those variables if present in the input file. Similar to how we handle printing.
In the first implementation, let's do the following:
Introduce FileReadNamelist node that accepts the file (handle) and list of variables to fill in (expr *vars).
In the LLVM backend translate this node into _lfortran_namelist_read. Possibly it might translate it to a sequence of calls per Support namelist #1999 (comment).
Later, if the namelist itself can be a global module variable, then we need to put it into the symbol table. But when the line read(u, some_namelist) is encountered by the frontend, it would translate it to FileReadNamelist with explicit vars, so it would reuse the previous two points.
Activity
ubaidsk commentedon Jul 22, 2023
How do we support this? I guess we need a new data structure/node at the ASR Level.
certik commentedon Jul 22, 2023
Yes, I need to think about it. This is very low priority, I think we'll just remove it from fastGPT. I initially thought I would set more variables this way, but it looks like we'll just set them at the command line if needed.
certik commentedon Sep 4, 2023
Duplicate: #1851
certik commentedon Mar 18, 2024
Let's figure out how to represent namelists at the ASR level. It would be good to design them in such a way as to allow (later) to represent any user-defined custom readers/writers for other formats like JSON, TOML, NPY, HDF5, GGUF, etc.
It looks like the
read(u, input_fastGPT)line will read a structure format from the textual input file. One way is to transform it to something like_lfortran_namelist_read(u, "A", A, "B", B, etc.), and it would populate those variables if present in the input file. Similar to how we handle printing.See also: j3-fortran/fortran_proposals#331.
certik commentedon Mar 19, 2024
One way that might work:
read(u, input_fastGPT)whereinput_fastGPTis a namelist that contains arraysA,Band an integerigets transformed intoLet's check how other compilers do this.
certik commentedon Jul 19, 2024
In the first implementation, let's do the following:
FileReadNamelistnode that accepts the file (handle) and list of variables to fill in (expr *vars)._lfortran_namelist_read. Possibly it might translate it to a sequence of calls per Support namelist #1999 (comment).read(u, some_namelist)is encountered by the frontend, it would translate it toFileReadNamelistwith explicit vars, so it would reuse the previous two points.XX namelist
XX namelist
XX: workaround for 'namelists'
ianfr commentedon Aug 3, 2025
Is this feature being actively worked on?
certik commentedon Aug 3, 2025
Not right now. If you want to send a PR, you can.