Metacompiler

Metacompiler

Metacompilers are a subset of a specialized class of compiler writing tools called compiler-compilers. The feature that sets a metacompiler apart from a standard compiler-compiler is that a metacompiler is written in its own language and translates itself.

Metacompilers are not only useful for generating parsers and code generators, they are also useful for generating a wide range of other software engineering and analysis tools.[1]

Besides being useful for parsing domain-specific languages, a metacompiler is itself a prime example of a domain-specific language, designed for the domain of compiler writing.

A metacompiler is defined by a set of grammar productions defining itself, written in its own specialized language. The metacompiler translates this grammar definition into the executable form of itself. Usually the grammar reduction rules are intermixed with semantic translation rules. Defining itself and translating itself this way constitutes the meta-step that sets a metacompiler apart from other compiler-compilers.

Since the metacompiler defines and translates itself, the question arises as to how it is initially created (a chicken and egg problem). This is solved in one of two ways: by cross-compiling or by bootstrapping. Cross-compiling involves translating the new metacompiler using some other compiler or metacompiler running on some other platform. This is similar to how you make more sourdough starter.

Bootstrapping, the other method, is an elegant (and usually mind-bending) process whereby the metacompiler is defined in progressively sophisticated stages and "bootstraps" itself. The first version of the metacompiler translation is executed by hand. That is, the programmer pretends to be the metacompiler, parsing its rules and generating the code just as the metacompiler would do if it existed, which it doesn't, at least not at that first stage. Once the initial metacompiler is up and running, in a simple embryonic form, the full-strength metacompiler is created by successively defining and translating more sophisticated versions of itself. That is, at each succeeding stage, version n of the metacompiler is used to generate its successor, version n+1.

A runtime module consisting of support functions required for the translation process usually rounds out the full metacompiler package. This would include input/output, symbol table, and string processing functions.

Historical

Metacompilers have played a significant role in both computer science and the build-up of the computer industry. Initial metacompilers included Meta-II[2] and its descendent TreeMeta.[3]

A MetaII Tutorial provides an online way to learn about MetaII.

Information about later descendents of these metacompilers is not generally available. With the resurgence of domain-specific languages and the need for parser generators which are easy to use, easy to understand, and easy to maintain, metacompilers are becoming a valuable tool for advanced software engineering projects.

The ideas about grammars, self-generation and extensions are widely used by Program transformation systems.

References

  1. ^ Neighbors, J.M. Software Construction using Components. Technical Report 160, Department of Information and Computer Sciences, University of California, Irvine, 1980.
  2. ^ Shorre, D.V., META II a syntax-oriented compiler writing language, Proceedings of the 1964 19th ACM National Conference, pp. 41.301-41.3011, 1964
  3. ^ C. Stephen Carr, David A. Luther, Sherian Erdmann, The TREE-META Compiler-Compiler System: A Meta Compiler System for the Univac 1108 and General Electric 645, University of Utah Technical Report RADC-TR-69-83.

See also


Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • metacompiler — metakompiliatorius statusas T sritis informatika apibrėžtis Kompiliatorius, kuris kompiliuoja kitus kompiliatorius. Pradiniai duomenys – formalus programavimo kalbos L aprašymas ir kompiuterio K komandų aprašymas. Rezultatas – kalbos L… …   Enciklopedinis kompiuterijos žodynas

  • Domain-specific language — Programming paradigms Agent oriented Automata based Component based Flow based Pipelined Concatenative Concurrent computing …   Wikipedia

  • compiler-compiler — metakompiliatorius statusas T sritis informatika apibrėžtis Kompiliatorius, kuris kompiliuoja kitus kompiliatorius. Pradiniai duomenys – formalus programavimo kalbos L aprašymas ir kompiuterio K komandų aprašymas. Rezultatas – kalbos L… …   Enciklopedinis kompiuterijos žodynas

  • metakompiliatorius — statusas T sritis informatika apibrėžtis Kompiliatorius, kuris kompiliuoja kitus kompiliatorius. Pradiniai duomenys – formalus programavimo kalbos L aprašymas ir kompiuterio K komandų aprašymas. Rezultatas – kalbos L kompiliatorius kompiuteriui K …   Enciklopedinis kompiuterijos žodynas

  • метакомпилятор — — [http://www.iks media.ru/glossary/index.html?glossid=2400324] Тематики электросвязь, основные понятия EN metacompiler …   Справочник технического переводчика

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”