Re: Is parliament allowed to formulate any law they want
Legislation can be used to discriminate against any single group of people they want. Like in the US only a US born person can run for President. You can not run for high level government office in the US if you are a naturalized citizen. In France you have to be of a certain pedigree. The french laws are more than convoluted.
Some governments have legislated that a president or prime minister must do military service in order to run. Others have rules which link to business and the like.
Secondly yes there is a limit on the legislature regarding what they can and can not do. Legislature can not invoke amendments and laws which are against the letter and spirit of the constitution. We are dealing with theory here and not practice. In theory the Supreme Court validates the legislation. If legislation is deemed illegal by the Supreme Court it can not become law. The Courts have the final say such matters.
Say Musharraf wants to become King, and his parliament invokes such legislation. The Supreme Court can rule on the matter and say that such legislation is against the letter and spirit of the constitution and thus not legal and can not be enforced. The final say on the legality of legislation is the Supreme Court.