Article View: comp.lang.clu
Article #5Re: Equates within a type_set.
From: Matti Jokinen
Date: Sun, 22 Oct 1989 01:35
Date: Sun, 22 Oct 1989 01:35
65 lines
3471 bytes
3471 bytes
In article <1235@scaup.cl.cam.ac.uk> scc@cl.cam.ac.uk (Stephen Crawley) writes:
>Does anyone out there put equate declarations inside a type_set?
I found one typeset with local equates in an old source file. The typeset was
used in a translator which handles several source and target languages. There
is one front end for each source language and one back end for each target
language. The intermediate representation is defined as an abstract data type
L_clause, where L is the target language. Front ends use a limited set of
primitive operations to construct L_clause objects, and these operations are
similar in each L_clause. Thus front ends can be parameterized by the type of
the intermediate representation. The header of the front end used to look
like this:
K_front_end = cluster[t: type] is ... where t in clausetypes
Identifier `clausetypes' was defined in a separate equate file:
clausetypes = {t| t has b2c: proctype(bool) returns(t),
i2c: proctype(bigint) returns(t),
r2c: proctype(real) returns(t),
ch2c: proctype(char) returns(t),
sp2c: proctype(sproc) returns(t),
t2c: proctype(typeval) returns(t),
id2c: proctype(string) returns(t),
s2c: proctype(string) returns(t),
ac2c: proctype(tvec) returns(t),
sc2c: proctype(tseq) returns(t),
mul: proctype(t,t) returns(t),
make_invocation: proctype(t,t) returns(t),
make_series: proctype(tseq) returns(t),
concat: proctype(t,t) returns(t),
make_procedure: proctype(t,t) returns(t),
make_iterator: proctype(t,t,t) returns(t),
make_yield: proctype(t) returns(t),
make_letrec: proctype(bindingseq) returns(t),
make_use: proctype(t,t) returns(t),
make_trap: proctype(t,proc_clause_seq,proc_clause)
returns(t),
make_if: proctype(t,t,t) returns(t),
make_case: proctype(t,proc_clause_seq,proc_clausety)
returns(t),
make_loop: proctype(t) returns(t),
make_for: proctype(t,t,t) returns(t),
make_while: proctype(t,t) returns(t),
make_repeat: proctype(t,t) returns(t)
tvec = array[t]
tseq = sequence[t]
proc_clause = struct[formal,body: t]
proc_clause_seq = sequence[proc_clause]
proc_clausety = oneof[none: null, procedure: proc_clause]
binding = struct[id: string, value: t]
bindingseq = sequence[binding]}
However, this typeset is not used in the current version. The reason is
that front ends now have three type parameters which are not independent
of each other. The typeset concept is not powerful enough to specify the
restrictions. What would be needed is a type relation of the form
{t,u,v: t has ..., u has ..., v has ...; <equates>}
In sum, local equates are useful in complicated typesets, but typesets are
not necessarily the best way to express complicated restrictions.
--
Matti Jokinen
Technical Details
Message-ID:
<992@tucos.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!purdue!bu-cs!bloom-beacon!eru!luth!sunic!tut!ra!tucos!polaris!mojReferences:
<1235@scaup.cl.cam.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!purdue!bu-cs!bloom-beacon!eru!luth!sunic!tut!ra!tucos!polaris!moj From: moj@polaris.UTU.FI (Matti Jokinen) Newsgroups: comp.lang.clu Subject: Re: Equates within a type_set. Summary: They may be useful in complicated programs Keywords: typesets Message-ID: <992@tucos.UUCP> Date: 22 Oct 89 01:35:00 GMT References: <1235@scaup.cl.cam.ac.uk> Sender: news@tucos.UUCP Reply-To: moj@utu.fi (Matti Jokinen) Distribution: inet Organization: University of Turku, Finland Lines: 65 Approved: moj@utu.fi