
Jonathan Turkanis wrote:
Simon Buchan wrote:
Jonathan Turkanis wrote:
Note that I'm not criticising the standard (although it certainly has some problems with lack of precision). It would be nice to have a truly formal specification, but in the case of C++ it's probably not realistic.
I do think it's possible
I said 'realistic'
I should have /emphasised/ it, sorry.
(If it wasn't, we wouldn't be able to write compilers for it!),
That's like saying: Of course it must be possible to provide a formal semantics for English -- otherwise I'd never be able to understand the instructiosn that come with my coffee maker :-)
Can you? If so, English (or more precisely, the subset used in the instructions) can be formally defined (in fact, you can find programs that do). The problem with natural languages is that they have a symbol table with trillions of entries, and that table is dynamicly generated based on the situation the compiler (ie, you) is in.
but remember the standard has basicly grown out of rewordings from the days of C (which did likewise back to B, etc...) I think a formal, but human-readable, grammar, kind of like EBNF for semantics, would be useful here.
It would be very useful (except I'm not sure what you mean by "kind of like EBNF for semantics")
Think algebra for syntax. That's EBNF. I don't know of any generalised definition of semantics (Turing machines don't count, 'cause they arn't human-readable (even the definition of Turing machines arn't!), and Lambda Calculus isn't general enough.) that would be useful, but feel free to correct me.