Article View: comp.lang.misc
Article #1616Re: How to make a language downward-extensible?
From: Chris Holt
Date: Mon, 24 Sep 1990 16:07
Date: Mon, 24 Sep 1990 16:07
34 lines
2390 bytes
2390 bytes
In article <28750:Sep2402:58:2290@kramden.acf.nyu.edu>
brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes:
>
>I'd like to focus on this point. Upward extensibility through macros and
>functions is pretty well understood. Its syntax may not be as well
>understood, but that's not a serious problem. What would it take to make
>a realistic language downward-extensible?
You'd want the components of an abstract machine model to be described
in the high-level notation, with an obvious, efficient implementation
(e.g. RegisterA := RegisterB + RegisterC
would be implemented as a single low-level instruction);
and you'd want parameters of the abstract machine to be constants
in the environment
(e.g. TimeForAddition
would return 12 nanoseconds, or whatever).
Then, each of the operations might be implemented on each of the
machines, either directly or as sequences of other operations;
and the conditionals would be in terms of
If TimeForAddition(AbstractStackMachine)
< TimeForAddition(AbstractVectorMachine) Then
Push(Pop1+Pop2)
Else
VectorR1 := VectorR2 + VectorR3.
This obviously isn't quite right, and there would have to be
relationships defined among the abstract machines; but I think
this approach might be the sort of thing you're looking for.
[Clearly, when the compiler can figure out which branch is to
be taken, only the code for that branch need be generated.]
-----------------------------------------------------------------------------
Chris.Holt@newcastle.ac.uk Computing Lab, U of Newcastle upon Tyne, UK
-----------------------------------------------------------------------------
"What two ideas are more inseparable than Beer and Virtual Reality?"
Technical Details
Message-ID:
<1990Sep24.160705.21113@newcastle.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!newcastle.ac.uk!turing!ncmhReferences:
<2581@l.cc.purdue.edu> <1990Sep22.061027.9223@d.cs.okstate.edu> <PCG.90Sep23181145@teachc.cs.aber.ac.uk> <28750:Sep2402:58:2290@kramden.acf.nyu.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!newcastle.ac.uk!turing!ncmh From: Chris.Holt@newcastle.ac.uk (Chris Holt) Newsgroups: comp.lang.misc Subject: Re: How to make a language downward-extensible? Message-ID: <1990Sep24.160705.21113@newcastle.ac.uk> Date: 24 Sep 90 16:07:05 GMT References: <2581@l.cc.purdue.edu> <1990Sep22.061027.9223@d.cs.okstate.edu> <PCG.90Sep23181145@teachc.cs.aber.ac.uk> <28750:Sep2402:58:2290@kramden.acf.nyu.edu> Sender: news@newcastle.ac.uk Organization: Computing Laboratory, U of Newcastle upon Tyne, UK NE1 7RU. Lines: 34