Re: Ten Commandments (On Topic!)



Hello,

FCC wrote:

<snip a bunch>

1. the marker characters that mark the beginning and end of NAMELIST
group can be different from compiler to compiler whereas `parsers' can
be written in 100% portable fortran.

Non-standard Fortran should be counted, here I think, as a different language. Standard namelist uses the same delimiter characters everywhere.

2. NAMELIST slows down the code and consumes too much space.

And a homebrew parser doesn't?

3. NAMELIST only works for TEXT files (does not work for BINARY files).

Binary files are non-standard. Namelist is formatted, i.e., human readable. Why add labels and comments to a file not intended to be read by humans?

4. Not all programs write their output in NAMELIST form, so if such
output will be used as the input or part of the input for another
program, then using NAMELIST becomes non-trivial (e.g. as in pipes,
where NAMELIST would not work).

Why doesn't namelist work in pipes?

Among these criticisms, I would agree on the 1st one partially, because
it is easy to fix (just change from &.../ format to $... $ format or
whatever is required by the compiler).

Or use whatever compiler switch or environment variable is needed to make the conversion magically. One must expect vendors to retain backwards compatibility.

However, this could be a problem
if compilers of conflicting standards need to be used often. No. 2 is
not so important because NAMELIST data is read usually once to input all
the variables so the run-time penalty should be minimal. No. 3 is also
not so important because most input data that need to be prepared by the
user are in TEXT files. No. 4 is, in my opinion, the real disadvantage.
However, one can use NAMELIST strictly for the user-prepared part of the
input file since that is where it is very useful. For other data that
come from other applications, a parser may still be needed.

On the other hand, NAMELIST
1. allows creation of lists that contain variable names that are
related, so the files become easier to maintain (both source code and
input files).
2. results in much less likelihood of introducing errors during the
transfer of data from the input file into variables (one can have bugs
in personal parsers, especially in the development stage).
3. causes data to be backward compatible automatically if one needs to
add new variables (with parsers this means more coding just to be able
to correctly transfer the data from the input file to the variables).

It appears to me that, NAMELIST is indeed a `simple automatic input-file
parser', which ought to help speed up coding. Then it should be included
in the list of `Ten Commandments' I believe, particularly inside item
no. 2. Especially in research work (like mine), often what counts is how
fast the correct results are obtained, and not how efficient the code works.

-- Cheers!

Dan Nagle
Purple Sage Computing Solutions, Inc.
.



Relevant Pages

  • Re: Tools for Front End.
    ... The other option I am planning is writting compiler without tools so ... parsers. ... aspect is what other processing you plan to do. ... the method used by the parser generator (e.g., ...
    (comp.compilers)
  • Language lawyer interpretation needed
    ... OpenWatcom v1.2 F77 compiler is being checked against the NIST test suite. ... they carry the proper input in comments, so I was able to construct an input file ... With the source file and the input file "changed" to avoid tab replacement, ...
    (comp.lang.fortran)
  • C++ compilation
    ... I plan to use the memoizing packrat parsers with the objects' ... files for each of the classes of keywords for the language and so on. ... the semantic tree serialized to memory, ... runtime type system for the compiler. ...
    (comp.compilers)
  • Re: noob question re: space delimited input
    ... Thanks George, dpb, and Richard. ... I am going to try with a different compiler, ... I have a test input file that called 'input.txt' containing: ... removed, so maxSize is probably ...
    (comp.lang.fortran)
  • Re: QteStartViewCreation - create source debugger views
    ... Steve Richter wrote: ... set DBGVIEW to anything that gets the compiler ... input file by the next stage in the compile, ... ILE RPG Root Source View - created by RPG preprocessor for the original ...
    (comp.sys.ibm.as400.misc)