META II outputs assembly code for a
stack machine. Evaluating this is like using an
Reverse Polish notation (RPN) calculator. expr = term $('+' term .OUT('ADD') /'-' term .OUT('SUB')); term = factor $('*' factor .OUT('MPY') / '/' factor .OUT('DIV')); factor = (.ID .OUT('LD ' *) / .NUM .OUT('LDL ' *) / '(' expr ')') ( '^' factor .OUT('XPN') / .EMPTY); 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: LDL 3 LD a LDL 2 XPN MPY LDL 5 ADD LD b DIV 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
: and
! 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 ==