Category: 

What is Metaprogramming?

Article Details
  • Written By: Jason Candanedo
  • Edited By: A. Joseph
  • Last Modified Date: 30 November 2016
  • Copyright Protected:
    2003-2016
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Although they mainly functioned as downspouts, gargoyles were also intended to scare people into attending church.  more...

December 3 ,  1989 :  The Cold War officially ended.  more...

Metaprogramming is the process of writing computer programs that, in turn, write other programs. The metaprogramming process allows greater flexibility to computer programmers because work usually done during the runtime period is allocated to the compile time period. This process frees up the programmer’s time to focus on other tasks because it cuts down on the time it takes manually write a program’s code. Recompilation is unnecessary because metaprogramming allows programs to tackle new situations with greater efficiency. "Metalanguage" is the term given to the computer language that the metaprogram utilizes.

Object language is the computer language of those programs that are written by the meta programming process. Reflexivity is a term given to metalanguage, which also can bring about metaprogramming. Metaprogramming works in various ways. One way is for the application programming interface to allow the programming code to access the insides of the runtime engine.

Another way that metaprogramming works is by allowing programs to write other programs through the dynamic execution process. In this case, string expressions are used in this process. Although the same language can be utilized in these two processes, it is not unusual for the languages to favor one process over the other.

Ad

Metaprogramming also works by circumventing the language. It allows for the alteration of languages through program transformation systems. This procedure gives metaprogramming the freedom to use languages even if the language does not employ any metaprogramming characteristics.

A source code is not needed for metaprogramming. It can be done by an incremental compilation or by runtime-changeable programs. The computer langaugae Lisp is the favored language for the metaprogramming process. This is because of the simplicity of this type of computer language as well as its power.

Metaprogramming that utilizes the Lisp language works by allowing the evaluation of code during the program definition time period, in contrast with the runtime period. This process renders the metaprogramming language and the host programming language the same. When this occurs, this Lisp routines can be recycled for the metaprogramming process.

Other languages have used this exact process with the integration of a program interpreter. This interpreter works with the data in the program. Domain-specific programming languages in metaprogramming are another form that create parsers and lexical analyzers. These allow the user to use regular expressions to define the language.

Ad

You might also Like

Recommended

Discuss this Article

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email