Re: GoTo in Java
- From: "Richard" <riplin@xxxxxxxxxxxx>
- Date: 26 Jan 2006 10:01:26 -0800
> If you had the "reverse compile to different language" feature, you
> could have the example written once, and then reverse compile it.
The problem with that is that you would never wind up with the example
as 'language x program' but as a 'language y program in x syntax'. The
way the code is best arranged for one language depends on features of
that and 'translation' requires 'complete rewrite'. It would require
that the translator identify idioms.
Cobol:
OPEN INPUT file
IF ( File-Status-1 NOT = "0" )
DISPLAY "Not found"
ELSE
PERFORM UNTIL EoF
READ file
AT END SET EoF
NOT AT END
process
END READ
END-PERORM
CLOSE file
END-IF
C:
if ( file = fopen(filename, "r") )
{
while ( ( recpoint = fgets(record, recmax, file) ) != NULL )
{ process; }
fclose(file);
}
else
puts("Not found");
Python:
try:
file = open(filename, "r")
except:
print "file not found"
else:
for record in file:
process
file.close()
.
- Follow-Ups:
- Re: GoTo in Java
- From: Oliver Wong
- Re: GoTo in Java
- From: Frank Swarbrick
- Re: GoTo in Java
- From: Howard Brazee
- Re: GoTo in Java
- References:
- GoTo in Java
- From: Howard Brazee
- Re: GoTo in Java
- From: Oliver Wong
- Re: GoTo in Java
- From: Frank Swarbrick
- Re: GoTo in Java
- From: Oliver Wong
- GoTo in Java
- Prev by Date: Re: GoTo in Java
- Next by Date: Re: test
- Previous by thread: Re: GoTo in Java
- Next by thread: Re: GoTo in Java
- Index(es):
Relevant Pages
|