C language semantic specification -
wikipidea says perl has dominant implementation used reference specification ,while c language specified standard ansi iso.
i learnt c language without reading single line of standard, normal...?
i know how standard (i.e. natural language document) capable of describing programming language without referring dominant implementation.
it's extremely rare find people learn programming language specification. spec targeted @ compiler authors (who need adhere word-for-word guarantee correctness) , final arbiter of what's legal in language. language specs extremely dense , technical, , not way learn program in language. often, advanced users of language read spec.
also, few languages defined in terms of reference implementation. languages defined relative abstract execution environment. example, c++ specification says that
the semantic descriptions in international standard define parameterized nondeterministic abstract machine. international standard places no requirement on structure of conforming implementations. in particular, need not copy or emulate structure of abstract machine. rather, conforming implementations required emulate (only) observable behavior of abstract machine explained below.
in other words, c++ specification describes how c++ programs need behave in purely theoretical sense. gives spec authors great leeway how define language. can talk "objects" , "pointers", example, without saying how have implemented. don't need how physical machine on c++ works, since can define machine behave want , leave actual compiler writers translate abstract machine onto physical machine.
some languages defined respect virtual machine (a great example of java). can talk behavior of java programs respect virtual machine saying how java programs interact virtual machine, , leave details of vm implementation vm implementers.
some other languages, such ml, have definitions purely mathematical. semantics of language described abstract mathematical transformations between states, meaning it's possible prove properties of ml couldn't shown if language defined relative reference compiler.
to summarize - language specifications complex documents few programmers go reading. they're compiler authors , define program in abstract term doesn't take machine account. way, language can defined in portable way, since can make conformant implementation on machine translating formal description machine operations.
hope helps!
Comments
Post a Comment