[...] for some time there was a belief that correct and full BNF
for C was impossible to give or too messy.
antispam@fricas.org (Waldek Hebisch) writes:
[...] for some time there was a belief that correct and full BNF
for C was impossible to give or too messy.
I find this statement hard to believe. There is nothing especially
difficult about a syntax for the C language. There is of course the well-known problem with typedef names, but that has long been
understood to be unresolvable in any context-free way (and so cannot
be dealt with in BNF). Earlier versions of C (pre-K&R) had other
syntax for some constructs, and maybe that was the issue. I'm at a
loss to understand how people could have thought a BNF for C, for
the post K&R version of the language, would be challenging or
difficult.
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
antispam@fricas.org (Waldek Hebisch) writes:
[...] for some time there was a belief that correct and full BNF
for C was impossible to give or too messy.
I find this statement hard to believe. There is nothing especially
difficult about a syntax for the C language. There is of course the
well-known problem with typedef names, but that has long been
understood to be unresolvable in any context-free way (and so cannot
be dealt with in BNF). Earlier versions of C (pre-K&R) had other
syntax for some constructs, and maybe that was the issue. I'm at a
loss to understand how people could have thought a BNF for C, for
the post K&R version of the language, would be challenging or
difficult.
I'm having trouble figuring out what you mean here. You acknowledge
that typedefs make a full BNF grammar for C impossible, and then
you say that it's not challenging or difficult.
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
antispam@fricas.org (Waldek Hebisch) writes:
[...] for some time there was a belief that correct and full BNF
for C was impossible to give or too messy.
I find this statement hard to believe. There is nothing especially
difficult about a syntax for the C language. There is of course the
well-known problem with typedef names, but that has long been
understood to be unresolvable in any context-free way (and so cannot
be dealt with in BNF). Earlier versions of C (pre-K&R) had other
syntax for some constructs, and maybe that was the issue. I'm at a
loss to understand how people could have thought a BNF for C, for
the post K&R version of the language, would be challenging or
difficult.
I'm having trouble figuring out what you mean here. You acknowledge
that typedefs make a full BNF grammar for C impossible, and then
you say that it's not challenging or difficult.
Because I think the problem with typedef names is orthogonal to
what Waldek was saying. The problem with typedef names is not
solvable in a context-free grammar, and that is just as true today
as it was 50 years ago. The syntax I am talking about is C syntax
without regard to the problem with typedef names.
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
Tim Rentsch <tr.17687@z991.linuxsc.com> writes:
antispam@fricas.org (Waldek Hebisch) writes:
[...] for some time there was a belief that correct and full BNF
for C was impossible to give or too messy.
I find this statement hard to believe. There is nothing especially
difficult about a syntax for the C language. There is of course the
well-known problem with typedef names, but that has long been
understood to be unresolvable in any context-free way (and so cannot
be dealt with in BNF). Earlier versions of C (pre-K&R) had other
syntax for some constructs, and maybe that was the issue. I'm at a
loss to understand how people could have thought a BNF for C, for
the post K&R version of the language, would be challenging or
difficult.
I'm having trouble figuring out what you mean here. You acknowledge
that typedefs make a full BNF grammar for C impossible, and then
you say that it's not challenging or difficult.
Because I think the problem with typedef names is orthogonal to
what Waldek was saying. The problem with typedef names is not
solvable in a context-free grammar, and that is just as true today
as it was 50 years ago. The syntax I am talking about is C syntax
without regard to the problem with typedef names.
I still don't understand your point. [...]
If you ask "how does it work?", the answer is that parsers using
that where shift-reduce parsers and priorities are used to choose
between shift and reduce actions. People also realised to
operator precedence can be used together with recursive descent,
leading to small and efficient parsers handling rich language.
Operator precedence alone puts restrictions on the language
(but there were languages specially designed to be parsed using
operator precedence), recursive descent alows more general
languages, but gets messy on constructs well handled by operator
precedence. AFAIK first C compiler used combination of operator
precedence and recursive descent, and for some time there was a
belief that correct and full BNF for C was impossible to give or
too messy. Current gramamr only appeared during ANSI process.
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <86pl2yi0n3.fsf@linuxsc.com>,
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
[...]
My main point is that "byte" and "octet" are talking about
different kinds of things.
Not really. It has always been understood to refer to the same
kind of thing that "byte" refers to.
I agree, at least for the way I understand the terms. For me,
"octet" and "byte" refer to the same kind of thing. [...]
I don't think what you said helped anyone.
In article <86ecjkshx0.fsf@linuxsc.com>,
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:
Examples of statically typed languages include SML, Haskell,
Rust, etc. Those are also all strongly typed.
Rust is not generally considered to be strongly typed.
By whom?
Rust has
raw pointers and unsafe functions, both of which (can) violate
type safety.
That is orthogonal to whether or not it the language is strongly
typed.
Perhaps you meant memory safety? In which case it is worth
stating that the langauge only guarantees memory safety for the
safe subset.
Dereferencing a raw pointer, including for assignment through
that pointer, can only be done in an `unsafe` block. Unsafe
functions have no _a priori_ bearing on memory (let alone type)
safety; they only impose the requirement that they must be
called from from an `unsafe` block.
Using the `unsafe` language requires using an `unsafe` block,
even in a function marked `unsafe` (admitted, this did change
from earlier editions of the language).
cross@spitfire.i.gajendra.net (Dan Cross) writes:
In article <86ecjkshx0.fsf@linuxsc.com>,
Tim Rentsch <tr.17687@z991.linuxsc.com> wrote:
cross@spitfire.i.gajendra.net (Dan Cross) writes:
Examples of statically typed languages include SML, Haskell,
Rust, etc. Those are also all strongly typed.
Rust is not generally considered to be strongly typed.
By whom?
Rust has
raw pointers and unsafe functions, both of which (can) violate
type safety.
That is orthogonal to whether or not it the language is strongly
typed.
Perhaps you meant memory safety? In which case it is worth
stating that the langauge only guarantees memory safety for the
safe subset.
Dereferencing a raw pointer, including for assignment through
that pointer, can only be done in an `unsafe` block. Unsafe
functions have no _a priori_ bearing on memory (let alone type)
safety; they only impose the requirement that they must be
called from from an `unsafe` block.
Using the `unsafe` language requires using an `unsafe` block,
even in a function marked `unsafe` (admitted, this did change
from earlier editions of the language).
There is something I would say here, but I am reminded that my
remarks would be off topic, so I simply going to stop. My
apologies for my earlier off-topic post upthread.
Bart <bc@freeuk.com> wrote:[about overflow]
I tried another experiment with printing the result of 2 * 2000000000 across several languages. All these printed -294967296:
C#
D
Java
Fortran
Kotlin
(All run from rextester.com.) These also printed an overflowed result:
| Sysop: | Tetrazocine |
|---|---|
| Location: | Melbourne, VIC, Australia |
| Users: | 14 |
| Nodes: | 8 (0 / 8) |
| Uptime: | 198:17:16 |
| Calls: | 218 |
| Files: | 21,503 |
| Messages: | 82,303 |