CPL - Chalmers Publication Library
| Utbildning | Forskning | Styrkeområden | Om Chalmers | In English In English Ej inloggad.

User Defined Syntax

Annika Aasa (Institutionen för datavetenskap)
Göteborg : Chalmers University of Technology, 1992. ISBN: 91-7032-738-6.

This thesis describes two examples of user defined syntax. The first, and most thoroughly investigated, is a new datatype construction, the conctype, the elements of which have a very flexible syntax. An embedded language can easily be introduced into a programming language using conctypes and computations are easily expressed using the concrete syntax and a special pattern matching form. The second example is user defined distfix operators which give a user possibility to extend the syntax for expressions in a programming language. We describe both a user's view and the implementation of these two examples.

In both cases, context-free grammars serve as a basis for the definition of the new syntax. A problem that is investigated is how to disambiguate grammars with precedences. To see how this should be done we investigate which language a grammar together with precedence rules defines. For a sub-class of context-free grammars we give a predicate that defines the precedence correct syntax trees according to some precedence rules. We also give an algorithm that transforms such a grammar to an ordinary unambiguous context-free grammar and prove the correctness of the algorithm. We use the algorithm in our implementation of distfix operators. For more general grammars, we isolate one kind of ambiguity which is suitable to resolve with precedence rules. We define the generated language for such a grammar by an attribute grammar. This approach of resolving ambiguity is used in the implementation of conctypes.

Nyckelord: datatype construction, conctype, syntax, programming, distfix operators, user's view, algorithms

Denna post skapades 2006-08-25. Senast ändrad 2013-09-25.
CPL Pubid: 1461


Institutioner (Chalmers)

Institutionen för datavetenskap (2002-2004)


Information Technology

Chalmers infrastruktur

Ingår i serie

Doktorsavhandlingar vid Chalmers tekniska högskola. Ny serie 890