Re: [stack] S-K Construction of Dip?
"William Tanksley, Jr" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
Manfred Von Thun <[email protected]> wrote: > On 24/2/07 9:45 PM, "Brent L Kerby" <[email protected]> wrote: > > But, if you can show me a really nice flat programming language, you may be > > able to change my mind :-) > Not a NICE flat programming language, but interesting in the present > context: machine language or assembler. I've been hammering this in my mind, but I can't get it to work out right. > Compile into machine language or assembler. Assignments translate into a > sequence of instructions, but that is of no interest here. Compound > statements translate into the sequence of instructions produced by the > sequence of statements, also of no interest. But interestingly, conditionals > and loops are translated into a FLAT sequence of instructions containing > two new instructions that are not in the source language: conditional and > unconditional JUMP instructions. We also have the notion of a program > counter, which is simply incremented by most instructions. Only the JUMP > instructions change the program counter explicitly. The problem is that machine language/assembler uses explicit offsets to express jumps and branches, and those destroy referential transparency. In effect, you can't split a valid program into two arbitrary parts and have the two parts still be valid -- if you cut in the middle of a branch, the branch will then lead off into nowhere. > A possible technique for flattening a concatenative language? Probably > yes. But the flattened version will not be pretty. Pretty is not yet my concern. But this isn't flat. But I do suspect there's something to this. I just have to figure out what I'm missing. > - Manfred -Billy