|
A metacompiler is a software development tool used chiefly in the construction of compilers, translators, and interpreters for other programming languages.〔 They are a subset of a specialized class of compiler writing tools called compiler-compilers that employ metaprogramming languages. Metaprogramming is the writing of computer programs with the ability to treat programs as their data.〔〔〔 The input to a metacompiler is a metaprogram written in a specialized metalanguage designed chiefly for the purpose of constructing compilers.〔〔〔 The language of the compiler produced is called the object language.〔 The minimal input producing a compiler is a metaprogram specifying the object language grammar and semantic transformations into an object program.〔〔〔 Metacompilers reduce the task of writing compilers by automating the aspects that are the same regardless of the object language. This makes possible the design of domain-specific languages which are appropriate to the specification of a particular problem. A metacompiler reduces the cost of producing translators for such domain-specific object languages to a point where it becomes economically feasible to include in the solution of a problem a domain-specific language design.〔〔 Metacompiler metalanguages are powerful string and symbol processing languages that are also useful for generating a wide range of other software engineering and analysis tools.〔〔 Besides being useful for domain-specific language development, a metacompiler is itself a prime example of a domain-specific language, designed for the domain of compiler writing. A metacompiler is a metaprogram ''usually written in its own metalanguage'' or an existing computer programming language. The process of a metacompiler, written in its own metalanguage, compiling itself is called ''reflection'', a metaprogramming term that in this case is equivalent to self-hosting compiler. Most common compilers written today are Self-hosting compilers. Reflection is a powerful tool, of many metacompilers, allowing the easy extension of their own metaprogramming metalanguage. The feature that separates a metacompiler apart from other compiler compilers is that it takes as input a specialized metaprogramming language that describes all aspects of the compilers operation. A metaprogram produced by a metacompiler is as complete a program as a program written in C++, BASIC or any other general programming language. The metaprogramming metalanguage is a powerful attribute allowing the ease of development of computer programming languages and other computer tools. Command line processors, text string transforming and analysis are easily coded using metaprogramming metalanguages of metacompilers. A full featured development package would include a linker and a run-time support library. Usually a machine oriented language is required for writing the support library. C or C++ could be used as a machine oriented language. A library consisting of support functions required for the compilation process usually rounds out the full metacompiler package. ==The meaning of metacompiler== In Computer Science the prefix ''meta'' is commonly used to mean ''about (its own category)''. As in metadata (about data). Data describing other data. A language that is used to describe other languages is a metalanguage. Meta may also mean ''on a higher level of abstraction''. A metalanguage operates on a higher level of abstraction in order to describe properties of a language. BNF (Backus–Naur Form) is a formal metalanguage originally used to define ALGOL 60. BNF is a weak metalanguage, for it describes only the syntax and says nothing about the semantics or meaning. Metaprogramming is the writing of computer programs with the ability to treat programs as their data. A metacompiler takes as input a metaprogram written in a specialized metalanguages (a higher level abstraction) specifically designed for the purpose of metaprogramming.〔〔〔 The output is an executable object program. An analogy can be drawn: That as a C++ compiler takes as input a C++ programming language program, a metacompiler takes as input a metaprogramming metalanguage program. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Metacompiler」の詳細全文を読む スポンサード リンク
|