Based on the Wikipedia page for a formal system, will all programming languages be contained within the following rules?
- A finite set of of symbols.
(This seems obvious since the computer is a discrete machine with finite memory and therefore a finite number of ways to express a symbol.)
A grammar.
A set of axioms.
A set of inference rules.
Are all possible languages constrained by these rules? Is there a notable proof?
EDIT:
I've been somewhat convinced that my question may actually be: can programming languages be represented by something other than a formal system?
Asked By : sdasdadas
Answered By : Gilles
Technically, yes, because you can make your formal system have a single axiom that says "the sequence of symbols is in the set $S$" where $S$ is the set of programs in the programming language. So this question isn't very meaningful. The notion of formal system is so general that it isn't terribly interesting in itself.
The point of using formal systems is to break down the definition of a language into easily-manageable parts. Formal systems lend themselves well to compositional definitions, where the meaning of a program is defined in terms of the meaning of its parts.
Note that your approach only defines whether a sequence of symbols is valid, but the definition of a programming language needs more than this: you also need to specify the meaning of each program. This can again be done by a formal system where the inference rules define a semantics for source programs.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/9977
0 comments:
Post a Comment
Let us know your responses and feedback