Multi-stage Programming
   HOME

TheInfoList



OR:

Multi-stage programming (MSP) is a variety of
metaprogramming Metaprogramming is a programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyze or transform other programs, and even modify itself ...
in which compilation is divided into a series of intermediate phases, allowing typesafe
run-time code generation In computer science, self-modifying code (SMC) is code that alters its own instructions while it is executing – usually to reduce the instruction path length and improve performance or simply to reduce otherwise repetitively similar code, th ...
. Statically defined types are used to verify that dynamically constructed types are valid and do not violate the type system. In MSP languages, expressions are qualified by notation that specifies the phase at which they are to be evaluated. By allowing the specialization of a program at run-time, MSP can optimize the performance of programs: it can be considered as a form of
partial evaluation In computing, partial evaluation is a technique for several different types of program optimization by specialization. The most straightforward application is to produce new programs that run faster than the originals while being guaranteed to ...
that performs computations at compile-time as a trade-off to increase the speed of run-time processing. Multi-stage programming languages support constructs similar to the
Lisp A lisp is a speech impairment in which a person misarticulates sibilants (, , , , , , , ). These misarticulations often result in unclear speech. Types * A frontal lisp occurs when the tongue is placed anterior to the target. Interdental lisping ...
construct of quotation and eval, except that
scoping In computer programming, the scope of a name binding (an association of a name to an entity, such as a variable) is the part of a program where the name binding is valid; that is, where the name can be used to refer to the entity. In other parts o ...
rules are taken into account.


References

{{reflist


External links


MetaOCaml
Programming paradigms Type systems