ArticleslgStudy

computer science

META II

META II is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand META II rather than just read about it. In short: META II is a domain-specific programming language for writing compilers. It was created in 1963–1964 by Dewey Val Schorre at University of California, Los Angeles (UCLA).

Key takeaways

  • META II belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect META II to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of META II from memory before moving on to harder problems.

Reference excerpt

META II is a domain-specific programming language for writing compilers. It was created in 1963–1964 by Dewey Val Schorre at University of California, Los Angeles (UCLA). META II uses what Schorre called syntax equations. Its operation is simply explained as:

Each syntax equation is translated into a recursive subroutine which tests the input string for a particular phrase structure, and deletes it if found. Meta II programs are compiled into an interpreted byte code language. VALGOL and SMALGOL compilers illustrating its capabilities were written in the META II language, VALGOL is a simple algebraic language designed for the purpose of illustrating META II. SMALGOL was a fairly large subset of ALGOL 60.

Notation META II was first written in META I, a hand-compiled version of META II. The history is unclear as to whether META I was a full implementation of META II or a required subset of the META II language required to compile the full META II compiler. In its documentation, META II is described as resembling Backus–Naur form (BNF), which today is explained as a production grammar. META II is an analytical grammar. In the TREE-META document, these languages were described as reductive grammars. For example, in BNF, an arithmetic expression may be defined as:

BNF rules are today production rules describing how constituent parts may be assembled to form only valid language constructs. A parser does the opposite taking language constructs apart. META II is a stack-based functional parser programming language that includes output directive. In META II, the order of testing is specified by the equation. META II like other programming languages would overflow its stack attempting left recursion. META II uses a $ (zero or more) sequence operator. The expr parsing equation written in META II is a conditional expression evaluated left to right:

Above the expr equation is defined by the expression to the right of the '='. Evaluating left to right from the '=', term is the first thing that must be tested. If term returns failure expr fails. If successful a term was recognized we then enter the indefinite $ zero or more loop were we first test for a '+' if that fails the alternative '-' is attempted and finally if a '-' were not recognized the loop terminates with expr returning success having recognized a single term. If a '+' or '-' were successful then term would be called. And if successful the loop would repeat. The expr equation can also be expressed using nested grouping as:

The code production elements were left out to simplify the example. Due to the limited character set of early computers the character / was used as the alternative, or, operator. The $, loop operator, is used to match zero or more of something:

The above can be expressed in English: An expr is a term followed by zero or more of (plus term or minus term). Schorre describes this as being an aid to efficiency, but unlike a naive recursive descent parser compiler it will also ensure that the associativity of arithmetic operations is correct:

With the ability to express a sequence with a loop or right ("tail") recursion, the order of evaluation can be controlled. Syntax rules appear declarative, but are actually made imperative by their semantic specifications.

Operation META II outputs assembly code for a stack machine. Evaluating this is like using a Reverse Polish notation (RPN) calculator.

In the above .ID and .NUM are built-in token recognizers. * in the .OUT code production references the last token recognized. On recognizing a number with .NUM .OUT('LDL' *) outputs the load literal instruction followed the number. An expression:

(3*a^2+5)/b will generate:

META II is the first documented version of a metacompiler, as it compiles to machine code for one of the earliest instances of a virtual machine.

The paper itself is a wonderful gem which includes a number of excellent examples, including the bootstrapping of Meta II in itself (all this was done on an 8K (six bit byte) 1401!)." – Alan Kay The original paper is not freely available, but was reprinted in Dr. Dobb's Journal, April 1980. Transcribed source code has at various times been made available (possibly by the CP/M User Group). The paper included a listing of the description of Meta II, this could in principle be processed manually to yield an interpretable program in virtual machine opcodes; if this ran and produced identical output then the implementation was correct. META II was basically a proof of concept. A base from which to work.

META II is not presented as a standard language, but as a point of departure from which a user may develop his own META "language". Many META "languages" followed. Schorre went to work for System Development Corporation where he was a member of the Compiler for Writing and Implementing Compilers (CWIC) project. CWIC's SYNTAX language built on META II adding a backtrack alternative operator positive and negative look ahead operators and programmed token equations. The .OUT and .LABEL operations removed and stack transforming operations :<node> and !<number> added. The GENERATOR language based on LISP 2 processed the trees produced by the SYNTAX parsing language. To generate code a call to a generator function was placed in a SYNTAX equation. These languages were developed by members of the L.A. ACM SIGPLAN sub-group on Syntax Directed Compilers. Schorre viewed the META II language in a general way:

The term META "language" with META in capital letters is used to denote any compiler-writing language so developed. Schorre explains META II as a base from which other META "languages" may be developed.

See also META_III OMeta TREE-META

Notes

References

External links ACM - Paper on META II Tutorial: Metacompilers Part 1 Meta II Meta Compiler

Worked examples

Example 1 — a first encounter with META II

Start with the simplest possible case. Write down what META II claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to META II before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about META II ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of META II

In research
META II appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses META II in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
META II is common in secondary-school and first-year university syllabi. It links to neighbouring topics 1960s software, Computer languages, Parser generators, so understanding it makes those chapters shorter.
In everyday life
Look for META II outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “META II” →

How to study META II in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what META II means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain META II out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is META II in simple terms?

META II is a domain-specific programming language for writing compilers. It was created in 1963–1964 by Dewey Val Schorre at University of California, Los Angeles (UCLA).

Why does META II matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study META II?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on META II.

Tags

  • 1960s software
  • Computer languages
  • Parser generators

Keep exploring