Sujet : Re: question about linker
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 04. Dec 2024, 20:23:26
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <viqa7g$12bus$1@dont-email.me>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 04.12.2024 18:43, Bart wrote:
[...]
Do you use a formal grammar when parsing a CSV file, or something
equally trivial?
Is that the reason why there's so many versions around that are
incompatible? CSV-parsing is not "trivial" if you look into the
details; you have to specify these (at first glance not obvious
details) to be sure that your "CSV-data" works not only with your
"CSV-parser" but that there's a common understanding of the CSV-
"language". (It's only few details; delimiters in string values,
escapes, and such, but enough to initiate incompatible formats.)
Yes, of course; if there would have been a formal specification
in the first place we wouldn't have the mess we now actually have.
And if you anyway write your tools only for yourself, and if you
don't intend to exchange data with others, no one cares what you
think a/the "CSV-format" actually is.
But we weren't discussing such comparably simple structures; we
have been discussing programming languages (and their grammars).
And most of us are considering sensible languages, not privately
hacked up toy languages or implementations of personal hobbies.
Parsers don't need such grammars. The information needed to construct
one manually can be in the programmer's mind,
And since you cannot look into the "C" language programmer's mind
you have issues understanding placement of braces vs. semicolons?
(Don't you see how stupid that is as an argument.)
Of course you can parse arbitrary data without grammar, and write
the tool to do that. - Is it because you can write your parser in
"0.3 seconds" where writing a specification requires "6.8 seconds"
that you don't specify but just start hacking (and document later)?
it might be an informal
description in English, it might be defined by examples of an existing
languages.
Human languages (specifically English with its many irregularities)
are worse than a formal language and a unreliable base and unsuited
as programming languages.
That's nothing more then a hacker's feeble excuse to justify his
ignorance.
Or the parser was created for a trivial language and has evolved.
Like, as I've heard, the Unix shell, with all it's irregularities
and quirks? - You really think this is a good paragon?
Even if some hacker defines a language ad hoc - and Intercal comes
to my mind - for a serious programming language you should have
[documented] syntax and semantics, and why the hell would anyone
use English instead of a formal specification for syntax.
A formal or informal grammar might be useful in a language reference -
once the language is stable.
For a hacker like you maybe. Professionals typically specify before
implementation.
[...]
For the rest of us, that part is the simplest part of a compiler. You
write it, and move on.
Is that the reason why your languages and compilers are so widespread
used? </sarcasm>
Janis