ALGOL-like Languages by Peter W. O’Hearn, Robert D. Tennent

By Peter W. O’Hearn, Robert D. Tennent

To build a compiler for a contemporary higher-level programming languagel one must constitution the interpretation to a machine-like intermediate language in a fashion that displays the semantics of the language. little is expounded approximately such struc­ turing in compiler texts which are meant to hide a wide selection of application­ ming languages. extra is expounded within the Iiterature on semantics-directed compiler development [1] yet right here too the point of view is particularly normal (though constrained to one languages with a finite variety of syntactic types). at the different handl there's a huge physique of labor utilizing the continuation-passing transformation to constitution compilers for the categorical case of call-by-value languages equivalent to SCHEME and ML [21 3]. ln this paperl we are going to describe a mode of structuring the interpretation of ALGOL-like languages that's in response to the functor-category semantics devel­ oped via Reynolds [4] and Oles [51 6]. an alternate procedure utilizing classification concept to constitution compilers is the early paintings of F. L. Morris [7]1 which anticipates our remedy of boolean expressionsl yet doesn't care for approaches. 2 forms and Syntax An ALGOL-like language is a typed lambda calculus with an strange repertoire of primitive forms. all through such a lot of this paper we imagine that the primi­ tive kinds are comm(and) int(eger)exp(ression) int(eger)acc(eptor) int(eger)var(iable) I and that the set eight of varieties is the least set containing those primitive forms and closed less than the binary operation -.

Show description

Read or Download ALGOL-like Languages PDF

Best programming: programming languages books

Objektorientierte Programmiersprache C++: Vollständige Einführung anhand von Beispielen (VDI-Buch) (German Edition)

In diesem Werk werden alle Aspekte der Sprache C++ behandelt, deshalb ist das Buch ebenso für Einsteiger, mit oder ohne Vorkenntnisse über eine andere Programmiersprache, als auch für Umsteiger von anderen Programmiersprachen bzw. C-Programmierer geeignet. Die Darstellung der Sachverhalte erfolgt knapp und systematisch, die Beispiele sind kurz, prägnant und compiler- unabhängig und auf allen Rechnern mit C++ 2.

Extra resources for ALGOL-like Languages

Example text

Otherwise, however, -r would contain more than one operator, so that a temporary variable must be used instead. Then the effect of ß' is to fill ß with the negation of the temporary, and to prefix to the resulting instruction sequence an assignment of r to the temporary: ß'S"r = sv := r[S;;'- s;n; /3S"'(-Sv) where sv =S' and when r rt (Ss"), S"' = sv + 1. ln the latter case, [ -e]rr,intexpS17S' ß will give an instruction sequence of the form instructions for setting temporaries in r ; sv := r[s;;' - s:;] ; ßS"' (-Sv) .

Li'SI7', where = 35 ]ohn C. ····mk-callcpnSin )] h = mk-subrcp 1 S a1 in = mk-subrcpnS an (ai, ... • an)= eS([p][rrlt:8],8SI7'). Here 17' and h, ... , in are mutual fixed points that can be represented in the compiler by using a reference for each of the instruction sequences i11 ••. , in. It is clear that the method outlined in this section could also be used to deal with source language types, such as record or object types, that are defined by products. To treat binary products, for example, one would take ne x e'> = (re) o

It may belarger than S' since the stack at this point may include temporaries occurring in r. • S"' = sv + 1 will be the current stack descriptor just after the assignment sv := r. It is just large enough to include the temporary sv. Thus, the effect of the displacement increment [s;;'- s;;1 is to deallocate any temporaries occurring in r and allocate the temporary sv. 25 ]ohn C. \S" . \r. ßS"(-r))), where usetmp is a function encapsulating the use of temporary variables: usetmp S' ßS" r = { when r E (Ss") ßS"r sv := r[S:l'- s;;J; ßS"'Sv when r f!

Download PDF sample

Rated 4.83 of 5 – based on 16 votes