Computer Science Canada turing to other code |
Author: | Prince [ Wed Apr 09, 2003 10:21 pm ] |
Post subject: | turing to other code |
can u directly translate turing code into another programming language like c++ or directx/opengl |
Author: | Asok [ Wed Apr 09, 2003 10:24 pm ] | ||||
Post subject: | |||||
no, different syntax ie. Turing
C++
|
Author: | Prince [ Wed Apr 09, 2003 10:25 pm ] |
Post subject: | |
well wat about putting the turing code into another language's compiler and having the compiler translate for u? can u do that? |
Author: | Tony [ Wed Apr 09, 2003 10:26 pm ] |
Post subject: | |
well the way turing compiler is structured, is it actually translated turing into C++ first, and compiles that. but you'd need to write your own translation program. If anyone is willing on starting the project, the rest of us will help. Having a turing to C++ translator would be very very nice. For multiple reasons. |
Author: | Asok [ Wed Apr 09, 2003 11:53 pm ] |
Post subject: | |
tony, that project is a lot harder than it sounds, you need to literally automate includes, structures, functions, headerfiles, classes, external libraries, etc. we would essentially be creating our own programming language with syntax identical to turing. |
Author: | Tony [ Thu Apr 10, 2003 7:49 am ] |
Post subject: | |
yes, basically... but if we do it the same way as turing does it, we just include ALL of include files. As for functions and stuff... they're already in the right place, we just need to change the syntax |
Author: | Martin [ Sat Apr 12, 2003 11:52 am ] | ||||||||||||||
Post subject: | |||||||||||||||
It may sound easy, but the structure is a lot different. For example, to read your name and put it to the screen in turing is
in c++
Now you see how it'd get complicated. Also, there are a bunch of things that you can't do in c++ that you can in turing. Take the following:
in c++, that's just
If you wanted to do either of these in turing, you couldn't in c++:
C++ arrays always start at 0, so 4 to 7 is impossible (but doable with a little improv.) This, however, can not be done:
Logically, in C++, this would look like this:
but c++ does not allow you to do that. It is possible to do something similar, but that requires using c++ vectors (beyond me for now)[/code] |
Author: | Dan [ Sat Apr 12, 2003 11:59 am ] |
Post subject: | |
for Quote: var x : array 4..7 of int why not just make an array like this in c: int x[7] it may be a wast of space but it whode wrok just like the other one. |
Author: | Tony [ Sat Apr 12, 2003 9:43 pm ] |
Post subject: | |
just do array[65000] or bug tom untill he tells us how he's done it. |
Author: | Asok [ Sat Apr 12, 2003 10:06 pm ] | ||||||
Post subject: | |||||||
lol guys All you need to do is calculate the the difference from the first to the last with a simple
oh and do to strings you need to
then your variable declaration is simply
as this will return the String type so you don't have to use char and also so the length is not predetermined to be more memory efficient. But that's the type of discussion we should be having in the C++ forum. |
Author: | yuethomas [ Sun Apr 13, 2003 11:37 am ] |
Post subject: | |
C++ only allows array definitions with subscripts being constants, if I remember correctly. |