文档下载 文档下载导航
设为首页 | 加入收藏
搜索 请输入内容:  
 导航当前位置: 文档下载 > 所有分类 > An Implementation of Standard ML in Poly
侵权投诉

An Implementation of Standard ML in Poly

This document describes an implementation of Standard ML [1] written in Poly [2]. This is a complete implementation of the language including the modules system. The original aim of the implementation was largely as an experiment in using

An Implementation of Standard ML in Poly David C.J. Matthews

1 Introduction This document describes an implementation of Standard ML 1] written in Poly 2]. This is a complete implementation of the language including the modules system. The original aim of the implementation was largely as an experiment in using Poly for implementing reasonably sized programs, and only secondarily to produce a working ML system. In fact, though, the Poly/ML compiler has been very successful and is in use for a number of serious projects. This description is mostly aimed at those interested in the details of the implementation or planning to implement their own compiler for ML or a similar language. It includes only the parts of the system speci c to ML. The low-level system is described in a separate report.

2 Overview The compiler can be divided fairly neatly into two main parts, the front-end which translates the ML source into a machine- and language-independent code-tree, and the back-end which optimises this code and translates it into machine-code. The back-end is shared between the Poly and ML compilers. The ML front-end takes three passes to get to the intermediate code. The rst pass parses the source text and generates the parse tree. It deals with in x precedences and type variables, but does no other identi er matching, in particular it does not distinguish between variables and constructors. The second pass matches up identi ers to their declarations and does the type checking. The third pass generates the intermediate code. It uses type information provided by the previous pass to resolve overloading and to do the completeness checking for patterns. The back-end consists of an optimiser which takes the code tree from the front end and generates an optimised copy for the code-generator. It recognises tailrecursion and procedures for which a full closure need not be made. The other optimisations, such as inline code expansion and handling type-vectors, are intended for code from the Poly compiler. The machine-code generator compiles the code into vectors in store. Currently there are code-generators for the Vax, for the Sun2 and Sun3 (68010 and 68020) and a version which generates an interpretable 1

第1页

你可能喜欢

热门文档

相关文档

站点地图 | 文档上传 | 侵权投诉 | 手机版
本站所有资源均来自互联网,本站只负责收集和整理,均不承担任何法律责任,如有侵权等其它行为请联系我们.
文档下载 Copyright 2013 doc.guandang.net All Rights Reserved.  -  email