Concrete syntax

Whereas the abstract syntax specifies a set of legal abstract syntax trees, the concrete syntax serves as the basis of a parser that translates text into an abstract syntax tree. The concrete syntax specifications include the tokens and keywords that allow a parser to construct an abstract syntax tree unambiguously. In Metal, the concrete syntax part of a specification is distinct from the abstract syntax part. The abstract syntax is more ``abstract'' in that it only deals with types, not tokens, which may be altered (e.g., substituting the french token lorsque for the english token when) without changing the essential part of the syntax. Indeed, a given abstract syntax could have any number of associated concrete syntax specifications, although the Metal language does not currently allow for this.

Metal concrete syntax specifications are compiled into Yacc and Lex programs that are themselves compiled into a parser. Metal does not allow for the lexical specification of atomic values; this is done with Lex. The final parser runs as an independent process whose behavior is specified through resources.


Tutorial