comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Verified compilers?
Date: Mon, 12 Mar 2012 10:43:41 +0100
Date: 2012-03-12T10:43:41+01:00	[thread overview]
Message-ID: <v18znvc2u2sk.aqnplls3016g.dlg@40tude.net> (raw)
In-Reply-To: 9s4mseFuoaU1@mid.individual.net

On Mon, 12 Mar 2012 00:22:06 +0200, Niklas Holsti wrote:

> On 12-03-11 11:47 , Dmitry A. Kazakov wrote:
>> On Sat, 10 Mar 2012 22:35:09 +0200, Niklas Holsti wrote:
>>
>>> On 12-03-10 12:36 , Dmitry A. Kazakov wrote:
>>>>
>>>> 1234 is an example of a language (of decimal literal).
>>>
>>> Or an example of octal literals, or hexadecimal literals, or telephone
>>> numbers. The meaning is not intrinsic in the string; it must be defined
>>> by other means.
>>
>> Which only supports my point.
> 
> What point is that? You have lost me. Or I you.

The point is that "1234" is meaningless. Whatever way you parse that
string, it is still nothing but a string.

>> Yes, meaning is a mapping of which string is the argument. The way this
>> mapping is computed (if computable) is irrelevant.
> 
> All language-processing programs, compilers and so on, compute with the 
> meanings of strings.

No. They are computing transformations invariant to the meaning.

Consider the source code of a program. You can modify it without knowing
what it does, while keeping it doing the same thing. You can translate a C
program into Ada without understanding it. A compiler does just same. There
is no dwarf sitting in the box who understands Ada. There is nobody in.

> First, the meaning must be strictly defined; 
> second, it must be practically computable.

No. Programs deal with incomputable meanings most of the time. Real
numbers, integer numbers, clock, user input are all incomputable.

>>> The grammar, and the corresponding
>>> parse trees, are tools for defining the strings in the language, and the
>>> meaning of each string.
>>
>> No, only the former. Example:
>>
>>     <numeral>  ::=<decimal-digit>[<numeral>]
>>
>> This does not define the meaning of 1234. It may hint the human reader that
>> <numeral>  has something to do with numbers. But numbers and their
>> properties are defined elsewhere (in mathematics). The mapping:<numeral>
>> corresponds to the number from the set X identified by the means Y must be
>> stated additionally to the grammar.
> 
> A plain grammar does not define meaning, agreed. The meaning is defined 
> by rules attached to the grammar productions.

No. The meanings are attached to the strings.

But what you said is already sufficient to ditch grammars, since you said
that it is rather the rules which carry the "meaning." Therefore I can take
whatever algorithm and attach "meaning" to its transitions/states. From
this point of view your grammars are just an algorithm among others. Why
specifically grammars? Why the way of programming using grammars should be
any better than one using tables, or whatever?

>> 1. If not unique, then you cannot claim that the structure of a particular
>> tree is inherent to the language. It is not.
> 
> I've never claimed that -- see the quote to which you are replying! The 
> parse tree depends on the grammar and the sentence, as I'm sure you know.

Then I don't understand your point about trees defining the meaning.

>> 2. If same grammar may be used with different meanings, then the grammar
>> does not define any of them.
> 
> See above. The grammar is the scaffold on which the meaning is defined, 
> by attribute computations or in other ways.

The same can be said about a piece of paper and pencil, files, keyboards,
displays etc. I don't understand your argument.

> But defining meaning by positional notation does not work so well for 
> the numeric literals in Ada. You would have to exclude underscores from 
> the position numbering, and also handle the optional base specification.

And what is the problem to exclude them? I heard of no one who had any
difficulty in understanding what Ada numeric literals mean. The problem you
describe has nothing to do with defining their meaning. It has to do with
your way of programming the parser.

You have much worse problems with Ada, e.g.

   <label-1> : loop ... end loop <label-2>;
 
where <label-1> must be equivalent to <label-2>. It is no problem to any
human reader to understand what does this mean. It is no problem to a
recursive descent parser. All Ada compilers handle it effortlessly. It is
only a problem for the *language* you chosen. Take another one, end of
story.

> What role does the number 
> 137 play in the meaning of the 137th token in the program?

Depends on what that program does. The meaning of a program is specific to
the domain, none of the compiler's business.

> So I still 
> wonder how you can define meaning without parsing, for languages more 
> complex than numeric literals.

Here it is: "acceptable to the customer." Troublesome as it is, but there
is no other way.
 
> If you want to compute with meanings, they must be computable, which 
> usually means they must be constructive. Counterexample?

Pi

[ Meanings are not computed, they are assigned to the computational states,
absolutely voluntarily, of course ]

> Look, I agree, of course, that the natural number 1234 exists, without 
> referring to the string "1234" or any grammar. That is mathematics. But 
> in computing, we are dealing with myriads of different languages, with 
> different domains of meaning, and we need computational definitions of 
> the meaning of sentences, at least for the aspects of "meaning" that are 
> involved in the specification, implementation, and validation of our 
> programs.

I still do not see how this may support grammars, or the point that when
Ada compiler sees "Pi" it must compute Pi, or that ARM's syntax annex
defines Pi?
 
> I feel that you are not really getting any meaning from what I write, 
> and vice versa, a bit.

Seems so.
 
>> All computers are finite and all programming languages are effectively
>> finite both in the terms of the source code length and the number of states
>> compiler programs may have.
> 
> This argument is one of the last recourses when you have no good answer.

Because this the killer argument. No computer can parse infinite language
or compute incomputable. If you want to handle such stuff [and you must all
the time!] you have to map it onto some finite/computable framework and
deal within the latter. You certainly lose something while doing this. And
it is again incomputable to reason about what was lost.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



  parent reply	other threads:[~2012-03-12  9:43 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-21 15:42 Verified compilers? Yannick Duchêne (Hibou57)
2012-02-24  1:41 ` Shark8
2012-02-24  8:52   ` Georg Bauhaus
2012-02-24 17:36   ` Peter C. Chapin
2012-03-06  1:27 ` Randy Brukardt
2012-03-06 17:24   ` Shark8
2012-03-06 17:43     ` Dmitry A. Kazakov
2012-03-06 19:03       ` Shark8
2012-03-07  5:33       ` Yannick Duchêne (Hibou57)
2012-03-07  9:12         ` Dmitry A. Kazakov
2012-03-07 17:49           ` Niklas Holsti
2012-03-07 20:17             ` Dmitry A. Kazakov
2012-03-07 23:28               ` Usefulness of Formal Notions in Programming (was: Verified compilers?) Georg Bauhaus
2012-03-08  9:24                 ` Usefulness of Formal Notions in Programming Dmitry A. Kazakov
2012-03-08 10:30                   ` Nasser M. Abbasi
2012-03-08 12:37                     ` Dmitry A. Kazakov
2012-03-08  0:42               ` Verified compilers? Randy Brukardt
2012-03-08  9:25                 ` Dmitry A. Kazakov
2012-03-08 18:10                   ` Niklas Holsti
2012-03-08 20:41                     ` Dmitry A. Kazakov
2012-03-08 18:02               ` Niklas Holsti
2012-03-08 20:40                 ` Dmitry A. Kazakov
2012-03-09  0:44                   ` Georg Bauhaus
2012-03-09 22:13                   ` Niklas Holsti
2012-03-10 10:36                     ` Dmitry A. Kazakov
2012-03-10 20:35                       ` Niklas Holsti
2012-03-11  9:47                         ` Dmitry A. Kazakov
2012-03-11 22:22                           ` Niklas Holsti
2012-03-12  5:12                             ` Niklas Holsti
2012-03-12  9:43                             ` Dmitry A. Kazakov [this message]
2012-03-14  8:36                               ` Niklas Holsti
2012-03-14  9:24                                 ` Georg Bauhaus
2012-03-14 11:14                                   ` REAL (was: Verified compilers?) stefan-lucks
2012-03-14 12:59                                     ` REAL Dmitry A. Kazakov
2012-03-14 13:30                                       ` REAL Georg Bauhaus
2012-03-14 13:51                                         ` REAL Dmitry A. Kazakov
2012-03-14 20:37                                           ` REAL Brian Drummond
2012-03-14 21:52                                             ` REAL Dmitry A. Kazakov
2012-03-14 13:52                                         ` REAL georg bauhaus
2012-03-14 17:42                                         ` REAL Jeffrey Carter
2012-03-14 10:14                                 ` Verified compilers? Dmitry A. Kazakov
2012-03-14 20:13                                   ` Niklas Holsti
2012-03-11 10:55                         ` Georg Bauhaus
2012-03-10 13:46                     ` Brian Drummond
2012-03-07  1:00     ` Randy Brukardt
2012-03-07 12:42   ` Stuart
2012-03-08  1:06     ` Randy Brukardt
2012-03-08  9:04       ` Jacob Sparre Andersen
2012-03-08  9:37         ` Dmitry A. Kazakov
2012-03-08 11:23           ` Simon Wright
2012-03-08 12:27             ` Dmitry A. Kazakov
2012-03-08 10:23         ` Brian Drummond
2012-03-08 23:38           ` Bill Findlay
2012-03-09 13:56             ` Brian Drummond
2012-03-09 14:43               ` Shark8
2012-03-09 21:51                 ` Brian Drummond
2012-03-09 15:49               ` Bill Findlay
2012-03-09 20:34                 ` Brian Drummond
2012-03-09 19:40               ` Jeffrey Carter
2012-03-09 20:39                 ` Brian Drummond
2012-03-09 23:59               ` phil.clayton
2012-03-08 15:23         ` Peter C. Chapin
2012-03-09  2:04         ` Randy Brukardt
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox