Formation of rocks

The three main ways terrestrial rocks are formed:
Rock can also form in the absence of a substantial pressure gradient as material that condensed from a protoplanetary disk, without ever undergoing any transformations in the interior of a large object such as a planet or moon. Astrophysicists classify this as a fourth type of rock: Primitive rock. Primitive rock is common in asteroids and meteorites.
Rock formation.
19th-century efforts to synthesize rocks.
The synthetic investigation of rocks proceeds by experimental work that attempts to reproduce different rock types and to elucidate their origins and structures. In many cases no experiment is necessary. Every stage in the origin of clays, sands and gravels can be seen in process around us, but where these have been converted into coherent shales, sandstone and conglomerates, and still more where they have experienced some degree of metamorphism, there are many obscure points about their history upon which experiment may yet throw light. Attempts have been made to reproduce igneous rocks, by fusion of mixtures of crushed minerals or of chemicals in specially contrived furnaces. The earliest researches of this sort are those of Faujas St Fond and of de Saussure, but Sir James Hall really laid the foundations of this branch of petrology. He showed (1798) that the whinstones (diabases) of Edinburgh were fusible and if rapidly cooled yielded black vitreous masses closely resembling natural pitchstones and obsidians. If cooled more slowly they consolidated as crystalline rocks not unlike the whinstones themselves and containing olivine, augite and feldspar (the essential minerals of these rocks).
Many years later Daubrée, Delesse and others carried on similar experiments, but the first notable advance was made in 1878, when Fouqué and Lévy began their researches. They succeeded in producing such rocks as porphyrite, leucite-tephrite, basalt and dolerite, and obtained also various structural modifications well known in igneous rocks, e.g. the porphyritic and the ophitic. Incidentally, they showed that while many basic rocks (basalts, etc.) could be perfectly imitated in the laboratory, the acid rocks could not, and advanced the explanation that for the crystallization of the latter the gases never absent in natural rock magmas were indispensable mineralizing agents. It has subsequently been proved that steam, or such volatile substances as certain borates, molybdates, chlorides, fluorides, assist in the formation of orthoclase, quartz and mica (the minerals of granite). Sir James Hall also made the first contribution to the experimental study of metamorphic rocks by converting chalk into marble by heating it in a closed gun-barrel, which prevented the escape of the carbonic acid at high temperatures. In 1901 Adams and Nicholson carried this a stage further by subjecting marble to great pressures in hydraulic presses and have shown how the foliated structures, frequent in natural marble may be produced artificially.
Extraterrestrial rock.
Off-Earth, rock can also form in the absence of a substantial pressure gradient as material that condensed from a protoplanetary disk, without ever undergoing transformations in the interior of a large object such as planets and moons. Astrophysicists classify this as a fourth type of rock: Primitive rock. 
Primitive rocks "have never been heated much, although some of their constituents may have been quite hot early in the history of our Solar System. Primitive rocks are common on the surfaces of many asteroids, and the majority of meteorites are primitive rocks."
An example of a primitive rock is the achondritic iron-nickel octahedrite mineral seen in the Widmanstätten pattern that is found in a number of iron-rich meterorites. Consisting of kamacite and taenite and formed under extremely slow cooling conditions—about 100 to 10,000 °C/Myr, with total cooling times of 10 Myr or less—it will precipitate kamacite and grow kamacite plates along certain crystallographic planes in the taenite crystal lattice.