*** Welcome to piglix ***

META II


META II is a domain-specific programming language for writing compilers. It was created in 1963-1964 by Dewey Val Schorre at 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. Compilers have been written in the META II language for VALGOL and SMALGOL, the former is a simple algebraic language designed for the purpose of illustrating META II, the latter is described as a fairly large subset of ALGOL 60.

META II was first written in META I. META I was a hand-compiled version of META II. The history is unclear as to whether META I and META II are different languages.

In the documentation, META II is described as a language resembling Backus normal form (BNF). Most syntax directed compilers of the day were described as BNF-like or as using BNF. There are differences between META II and BNF; for example, in BNF, an arithmetic expression is defined as:

The BNF rule does not tell us how we should parse an expression, while in META II, the order of testing is specified by the equation. The expr parsing equation written in META II is a conditional expression evaluated left to right:

Above the expr equation is defined by expression to the right of the '='. Evaluating left to right from the '=', term is the first thing that must be tested. If term fails expr fails. If a term is recognized we then look for a '+' if that fails the alternate '-' is tried and finally if a '-' were not recognized the alternate .EMPTY always succeeds and expr returns success recognizing a single term. If a '+' or '-' were matched then expr would be recursively attempted. In META II an equation is a function returning success or failure. 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 examples have used a recursive rule to more closely match the BNF rule. However the evaluation order is a right most first order. That is 5-2+1 would be evaluated as 5-(2+1) A loop would be used to make the implied grouping: (5-2)+1. The $, loop operator, is used to match zero or more of something:


...
Wikipedia

...