Is this old hat, or something new?
I have come up with a simple way to generate optimal jump code for all
basic control flow instructions:
IF-THEN
IF-THEN-ELSE
WHILE-DO
DO-WHILE
The generated code takes an absolute minimum memory space and absolute
minimum execution time within the precise semantic meaning of the
specified source code. Is this something new, or has it already been
done?
[Good question. I doubt that it's new, but it may be one of those bits
of folklore that's never been properly written up. -John]
> On Jun 14, 1:24 pm, SeeScreen <seescr...@gmail.com> wrote:
>> I am estimating that generating an absolute minimal number of
>> instructions, and short-circuiting the compound condtional at the
>> earliest possible point in the execution trace has probably already
>> been accomplished for many years.
>>
>> Is this old hat, or something new?
>
> I have come up with a simple way to generate optimal jump code for all
> basic control flow instructions:
> [Good question. I doubt that it's new, but it may be one of those bits
> of folklore that's never been properly written up. -John]
I expect the paper by Danvy and Damian at
http://en.scientificcommons.org/511287 may be what you want. The
abstract states:
Starting from an operational specification of a translation from a
structured to an unstructured imperative language, we point out how a
compositional and context-insensitive translation gives rise to static
chains of jumps. Taking an inspiration from the notion of
continuation, we state a new compositional and context-sensitive
specification that provably gives rise to no static chains of jumps,
no redundant labels, and no unused labels. It is defined with one
inference rule per syntactic construct and operates in linear time and
space on the size of the source program (indeed it operates in one
pass).
Torben