Ancient Turing abbreviated syntax
Author |
Message |
DirkL
|
Posted: Fri Jul 22, 2011 5:24 am Post subject: Ancient Turing abbreviated syntax |
|
|
I have an unbelievably ancient Turing program and am trying to get it to run.
This program has lots of lines like
{+n:0..level mu(n) := (1-1/(4.0*n*n-1))}
This used to be an abbreviation for
for n:0..level mu(n) := (1-1/(4.0*n*n-1))} end for
There are plenty of other strange symbols, like `|:` and `>>>`.
Turing 4.1.1 does not recognize them. So I have two questions:
1. Does anybody know where I can find a compiler that does?
2. Is there anywhere I can check whether I remember the meaning of all those symbols correctly? |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
apython1992

|
Posted: Fri Jul 22, 2011 6:48 am Post subject: RE:Ancient Turing abbreviated syntax |
|
|
This is probably no longer supported (actually, the entire language is no longer supported) because it makes for hard-to-read code. However, this website has probably more information on Turing than any other out there and you can probably get your question answered by reading some of the stuff on here. here is the main page for everything Turing. You can try installing any one of those versions to see if it will run your code if you really feeling using the old syntax (for the sake of simply running old programs), but if you have a little free time you may as well go with making your programs compatible with 4.1.1, as this is what most people who know Turing (very little to begin with) are familiar with. |
|
|
|
|
 |
Tony

|
Posted: Fri Jul 22, 2011 7:52 am Post subject: RE:Ancient Turing abbreviated syntax |
|
|
If I had to guess, that syntax comes from the "classic Turing" (previously known as just "Turing". What is now known as Turing used to be "Object Oriented Turing"). Even if you somehow find one of those much older compilers, you'd also need an old enough operating system for it to make sense. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
DirkL
|
Posted: Fri Jul 22, 2011 9:51 am Post subject: [SOLVED] Ancient Turing abbreviated syntax |
|
|
Tony @ Fri 22 Jul, 2011 14:52 wrote: If I had to guess, that syntax comes from the "classic Turing" (previously known as just "Turing". What is now known as Turing used to be "Object Oriented Turing"). Even if you somehow find one of those much older compilers, you'd also need an old enough operating system for it to make sense.
I have written a Lua script that can translate all my old files. No claims that it will work on anything else. The translated file successfully compiles and runs under 4.1.1.
code: |
function ifstatement(s)
s = (s:sub(2,-2)):gsub(':',' then ',1)
s = s:gsub('|:',' else ')
s = s:gsub('|(.-):',' elsif %1 then')
return ' if '..s..' end if; '
end
function loopstatement(s)
s = s:sub(2,-2)
if s:match("^%s*%+") then s = " for "..s:gsub("^%s*%+","",1).." end for; "
elseif s:match("^%s*%-") then
s = " for decreasing "..s:gsub("^%s*%-","",1).." end for; "
else s = " loop "..s.." end loop; "
end
s = s:gsub(">>%s*:"," exit when ")
return s
end
rules = {
{'%b[]', ifstatement },
{'%b{}', loopstatement },
{'>>>',' return '}
}
function apply (line, rules)
for _,rule in ipairs(rules) do
while true do
local s=0
line, count = line:gsub(rule[1],rule[2])
if count==0 then break end
end
end
return line
end
print(apply(io.read("*a"),rules))
|
|
|
|
|
|
 |
Brightguy

|
Posted: Fri Jul 22, 2011 11:39 am Post subject: Re: RE:Ancient Turing abbreviated syntax |
|
|
Tony @ Fri Jul 22, 2011 7:52 am wrote: Even if you somehow find one of those much older compilers...
I actually have a physical copy of Turing 8.0C. I could also probably find copies of versions 6 and 7 in my archives if someone wants to start a museum. |
|
|
|
|
 |
Tony

|
Posted: Fri Jul 22, 2011 11:47 am Post subject: RE:Ancient Turing abbreviated syntax |
|
|
@Brightguy -- a copy of that would be much appreciated. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
[Gandalf]

|
Posted: Sat Jul 23, 2011 11:03 pm Post subject: RE:Ancient Turing abbreviated syntax |
|
|
I think I still have one of those on a floppy somewhere as well. I don't remember ever seeing the odd syntax in the OP though. |
|
|
|
|
 |
Tony

|
Posted: Sat Jul 23, 2011 11:23 pm Post subject: RE:Ancient Turing abbreviated syntax |
|
|
I've got a couple of versions from Brightguy. If you have another (and your floppy is not demagnetized), I'll take that as well. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
 |
Sponsor Sponsor

|
|
 |
|
|