A constitution is the set of most fundamental laws in a country which determines how the country will be governed. All other laws of the country must agree or at least not contradict the constitution.
The constitution usually specifically states the rules of forming and choosing the government.