Computer Science Canada

Turing Interpreter - ICS3U Final Project

Author:  trishume [ Fri Jul 01, 2011 10:08 am ]
Post subject:  Turing Interpreter - ICS3U Final Project

For my grade 11 programming final project/summative/ISU this year I implemented turing in turing. It also includes an editable, multi-line textbox that some people might find useful.

It can run simple turing programs but it doesn't have arrays or object orientedness. It comes with a bunch of example programs that it can run, including someone else's final project. Meta major project! Smile

The full project includes media and the parser which is generated in java. It's about 23,000 lines in total. Shocked

But I only wrote 5,000 lines.
The rest are generated. About 10,000 were generated by the antlr parser generator.
Another 7,000 were generated by a ruby program that I wrote that parses the turing documentation and turns it into interfaces. Wink

I also took the liberty of changing some of the things I don't like about turing. I made it dynamically typed. You don't have to declare any variables, or record fields. Just assign to them.

There's more information in the advertising I had to submit:
http://tristan.hume.ca/tint/

The github page has the download and more info:
https://github.com/trishume/TuringInTuring

What do you think of it. Feedback is appreciated.

Author:  Tony [ Fri Jul 01, 2011 12:39 pm ]
Post subject:  RE:Turing Interpreter - ICS3U Final Project

Tristan Hume (with help from linecount.sh) wrote:

Around the same number of lines of good code as Adam Bielinski's Forces.

Laughing great testimonial quote!

Since everything on GitHub comes from an "Initial Commit", have you been developing all of this without source control (or just elsewhere)?

Author:  trishume [ Sun Jul 03, 2011 6:54 pm ]
Post subject:  Re: RE:Turing Interpreter - ICS3U Final Project

Tony @ Fri Jul 01, 2011 12:39 pm wrote:
Tristan Hume (with help from linecount.sh) wrote:

Around the same number of lines of good code as Adam Bielinski's Forces.

Laughing great testimonial quote!

Since everything on GitHub comes from an "Initial Commit", have you been developing all of this without source control (or just elsewhere)?


I've been developing it off of my USB key for a couple months. So that I could work on it in programming class and occasionally at home.

If you look at the rest of my repos on github you will notice that everything is an initial commit.
I have just started moving some of my code to github in the last few days.
It's too bad turing and perl share an extension. It means you can't find other people's turing code on github. It all gets written off as perl.

Have you tried running it? What do you think?

Author:  Tony [ Sun Jul 03, 2011 7:36 pm ]
Post subject:  Re: RE:Turing Interpreter - ICS3U Final Project

trishume @ Sun Jul 03, 2011 6:54 pm wrote:
It means you can't find other people's turing code on github.

I doubt that there is any other Turing code on GitHub...

I didn't actually run this, as I no longer have CrossOver on my computer.

Author:  trishume [ Mon Jul 04, 2011 7:42 am ]
Post subject:  Re: RE:Turing Interpreter - ICS3U Final Project

Tony @ Sun Jul 03, 2011 7:36 pm wrote:
trishume @ Sun Jul 03, 2011 6:54 pm wrote:
It means you can't find other people's turing code on github.

I doubt that there is any other Turing code on GitHub...

I didn't actually run this, as I no longer have CrossOver on my computer.


If you look at my advertising screenshot you will see that it is from a mac.
You can download Wine for mac and it runs excellently, for free!

Author:  trishume [ Mon Sep 05, 2011 6:53 pm ]
Post subject:  Re: Turing Interpreter - ICS3U Final Project

Screenshot and zip file:

Posted Image, might have been reduced in size. Click Image to view fullscreen.[/img]

Author:  Insectoid [ Mon Sep 05, 2011 8:05 pm ]
Post subject:  RE:Turing Interpreter - ICS3U Final Project

Why hasn't this gotten more attention? I can't run it (same deal as Tony, and my CiderX/WineX/CXZ engines conflict with Wine) but it looks like you put a fair amount of effort in. It might well be one of the highest-quality submissions we've gotten, and perhaps THE highest-quality non-game submission (I can't confirm that though).

Author:  ProgrammingFun [ Mon Sep 05, 2011 8:39 pm ]
Post subject:  Re: Turing Interpreter - ICS3U Final Project

Insectoid @ Mon Sep 05, 2011 8:05 pm wrote:
Why hasn't this gotten more attention? I can't run it (same deal as Tony, and my CiderX/WineX/CXZ engines conflict with Wine) but it looks like you put a fair amount of effort in. It might well be one of the highest-quality submissions we've gotten, and perhaps THE highest-quality non-game submission (I can't confirm that though).
I definitely agree! This program is amazing and IMO, it should be included on the official Turing page. Great work, I'm gonna try to run my old Turing project on it when I find the time (will post here when done).
I think it would be awesome if we could get a interpreter for Turing built on another language (just a thought).

Author:  Insectoid [ Mon Sep 05, 2011 9:18 pm ]
Post subject:  Re: Turing Interpreter - ICS3U Final Project

ProgrammingFun @ Mon Sep 05, 2011 8:39 pm wrote:
Insectoid @ Mon Sep 05, 2011 8:05 pm wrote:
Why hasn't this gotten more attention? I can't run it (same deal as Tony, and my CiderX/WineX/CXZ engines conflict with Wine) but it looks like you put a fair amount of effort in. It might well be one of the highest-quality submissions we've gotten, and perhaps THE highest-quality non-game submission (I can't confirm that though).
I definitely agree! This program is amazing and IMO, it should be included on the official Turing page. Great work, I'm gonna try to run my old Turing project on it when I find the time (will post here when done).
I think it would be awesome if we could get a interpreter for Turing built on another language (just a thought).


http://compsci.ca/v3/viewtopic.php?t=16008

Unfortunately the project has stalled.

Author:  mirhagk [ Mon Sep 05, 2011 11:01 pm ]
Post subject:  RE:Turing Interpreter - ICS3U Final Project

Yes insectoid, but that was a compiler, this is an interpreter (an easier project, albeit still very difficult)

Author:  trishume [ Tue Sep 06, 2011 3:55 pm ]
Post subject:  Re: Turing Interpreter - ICS3U Final Project

My posting the screenshot was a covert bump. No one had looked at it because it was summer. Wink

The thing about writing it in another language is that the standard library is huge. I just wrote a ruby program to parse the docs and write 5000 lines of wrapper code for the library functions.

5000 lines without even implementing any of the library!

It currently has small incompatibilities that break most programs. Because it of dynamic typing ,equivelant syntax for arrays and functions and time constraints I couldn't do arrays or objects

Reals and ints are also have no coercion. You have to write 3.5 * 100.0 instead of 3.5 * 100. (look at the 3D sphere demo for how reals work)

There are also various problems with keyboard detection difference (look at the vervoot major project demo for keyboard detection)

In general: dynamic typing was not a perfect conversion and I did not have time to fix the problems and add important things like arrays.

Author:  mirhagk [ Tue Sep 06, 2011 6:39 pm ]
Post subject:  RE:Turing Interpreter - ICS3U Final Project

I think I am going to look into this code, and look into creating a Turing interpreter in another language.

Author:  trishume [ Tue Sep 06, 2011 6:58 pm ]
Post subject:  Re: Turing Interpreter - ICS3U Final Project

good luck mirhagk.

Implementing all 320+ library functions will take a long time. Implementation of the interpreter will be easier in some other language though.

Author:  [Gandalf] [ Tue Sep 06, 2011 7:38 pm ]
Post subject:  Re: Turing Interpreter - ICS3U Final Project

trishume @ 2011-09-06, 6:58 pm wrote:
good luck mirhagk.

Implementing all 320+ library functions will take a long time. Implementation of the interpreter will be easier in some other language though.

You could always leave the libraries implemented in Turing, at least for a start.

I took a look, nice project! Though it needs some work before being practically usable as a Turing-ish interpreter. You deserve bonus points for hosting it on github. Wink

Author:  mirhagk [ Wed Sep 07, 2011 8:42 am ]
Post subject:  RE:Turing Interpreter - ICS3U Final Project

Gandalf has a point with leaving the library functions implemented in Turing. They can be slowly implemented in the interpreter itself as I go along, and decide that something is more critical etc. For instance things that relate to drawing should be implemented in the interpreter.

Author:  trishume [ Wed Sep 07, 2011 5:52 pm ]
Post subject:  Re: Turing Interpreter - ICS3U Final Project

How would you link the turing library functions to another language? If it's possible that's awesome. I could write an OpenGL drawing extension for turing.

Author:  mirhagk [ Thu Sep 08, 2011 6:45 am ]
Post subject:  RE:Turing Interpreter - ICS3U Final Project

Well you would have difficulties doing it within Turing. But if the interpreter was written in like C++ for example, you could easily write the basic functions, and then just find the standard library and include those in every Turing program it runs.

From there it's just a matter of overriding each of the draw functions or something.

Actually this kind of gave me an idea to use Turing as an interface to communicate with another program that will run and take care of Turing's drawing. The only thing is getting the two programs to communicate, I could use the loopback address, or I could use a text file, but I'm not sure what the fastest way would be.

Author:  trishume [ Thu Sep 08, 2011 3:02 pm ]
Post subject:  Re: Turing Interpreter - ICS3U Final Project

The turing standard library is not written in turing. It is written in C or something. The turing source has not been released so you can not use the standard library in another language. Also, sockets and text files would both be way too slow for graphics.

Author:  mirhagk [ Thu Sep 08, 2011 7:57 pm ]
Post subject:  RE:Turing Interpreter - ICS3U Final Project

They have a folder of predefs.... I know that there are some functions that you will need to implement, but a lot of of the standard library are interfaces for just a couple core functions.

Author:  trishume [ Fri Sep 09, 2011 6:44 pm ]
Post subject:  Re: Turing Interpreter - ICS3U Final Project

cool. I'll have to take a look at that.


: