[Solved]: Number of possible programs in a language

Problem Detail: Is the number of possible programs usually finite or infinite? I’m playing with the idea of generating all possible programs for a language – is that even a finite number or must we be more specific, finite RAM etc?

Asked By : Dac Saunders

Answered By : Andrej Bauer

When considering such questions we usually disregard limitations of real computers and think about a programming language theoretically. A general-purpose programming language (any language used in practice falls into this category) has infinitely many programs. Furthermore, all programs can be generated systematically. Implementing a program which generates all programs may be a useful learning experience, but has little actual value. The number of all programs of length $n$ is exponential in $n$ and so is unfeasable, except for fairly small values of $n$.
Best Answer from StackOverflow

Question Source : http://cs.stackexchange.com/questions/58028  Ask a Question  Download Related Notes/Documents

Leave a Reply