Common lisp implementation of Val Schorr's Meta-II language
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
aexp.masm
metaii.masm
metaii.meta
metavm.lisp

README.md

Meta II

Introduction

This is an implementation of Val Schorre's Meta II language, written in Common Lisp. Meta II is a compiler-writing language for syntax-directed translation, expressed in a syntax similar to BNF rules that are annotated to produce code in the target language. The code here is a virtual machine for the target language. The Meta II compiler can itself be written in Meta II.

Schorre, D.V., 1964. Meta II: a Syntax-oriented Compiler Writing Language. In Proceedings of the 1964 19th ACM national conference (pp. D1.3-1 -- D1.3-11).

Other useful references:

The files

File Contents
metaii.lisp The virtual machine in Common Lisp
aexp.masm James Neighbors algebraic expression syntax, compiled by Meta II
metaii.meta The Meta II interpreter in Meta II
metaii.masm The Meta II interpreter, compiled by Meta II

Examples

  • A simple example (from James Neighbors) of an algebraic expression language:
(run (build-instructions (parse-file "aexp.meta"))
     "fern:=5+6;ace:=fern*5;waldo:=fern+alpha/-beta^gamma;")
  • Compiling the Meta II compiler.
(run (build-instructions (parse-file "metaii.meta"))
     (file-as-string "metaii.meta"))
  • Compiling the Meta II compiler using the compiled Meta II compiler.
(run (build-instructions (parse-file "metaii.masm"))
     (convert-single-to-double (file-as-string "metaii.meta")))