Loading...

Turing: Another Take on Algorithm and Python Development

View: 197    Dowload: 0   Comment: 0   Post by: admin   Category: Development Tools   Fields: Other

A cross-platform algorithm/pseudocode and Python development environment with debugging features

Links

Introduction

Turing is quite basic but a powerful IDE written in Python that allows quick and easy development of algorithms and Python scripts.

Background

I live in France. Here, programming has been taught in schools at high school level for a few years already; although it's not the kind of programming people usually learn. Teachers don't teach code, instead we only do what could fit under the name "algorithm". Basically, we learn the theory, how the program flow works, what variables are, what recursion is, etc. Here, you only start doing "real" code in college.

Since we don't do "real" code but instead do this weird pseudocode-like algorithm thingy, we needed a software for that, because theory ain't moving mountains. That's what happened when a few years ago, a French math teacher wrote the software Algobox (clever portemanteau amirite). Since it could do what everyone wanted to do, and since it was really the only available software at the time, it quickly became the reference and you see screenshots of it everywhere in math textbooks.

It's nice. You can do basic stuff, it's funny and all, but it's quite limited. Until very recently, you couldn't create functions, and it doesn't provide any real debugging features apart from a basic step-by-step feature that doesn't show you where in the program you are.

Last year, people at the top decided it'd be good to start teaching kids Python, 'cause it really whips the llama's ass. Standard pseudocode will still be taught, but now kids will do Python too.

Problem.

Almost all available Python IDEs were made with the idea in mind that they would be used by programmers. We're talking about 14-years old kids whose main use of computers is YouTube. The GUIs of those IDEs were made for people that know what they're doing, which is clearly not the case here.

That's where the idea for Turing came from. Make a new IDE, with support for both pseudocode and Python, that could be used even by beginners.

Okay, That's Nice and All But What Does It Look Like?

As Aristotle said, "A screenshot is worth a thousand words."

More screenshots here (new window).

Behind the Scenes

The program can work in two modes: algorithm/pseudocode and Python. Both modes can use Turing's function library, I/O functions and plot window.

We originally planned to use Python for the pseudocode expressions, but we concluded it would be easier for beginner to write a new, simpler syntax, thus we wrote our own in-house expression engine, with its own recursive parser and function library. Its syntax is quite similar to Python's, except for a few minor differences:

  • The ^ operator is used for exponentiation (the XOR operator is used for XOR instead).
  • Complex numbers use the traditional mathematical syntax (i is used instead of j).
  • There is only one number type (instead of separate intfloat and complex).
  • Products can be done without explicitly using the * operator (example: 2pi3x^2).

Lambda functions can be used using the notation {x, y}(x ^ 2 + y * 3} and are first-class objects as in Python.

Debugging

In pseudocode mode, it is possible to use breakpoints and to run the program in step-by-step mode.

In Python mode, step-by-step is not available yet and only breakpoints can be used.

There are two buttons to run a pseudocode program: Run and Debug. The first button converts the lines to Python code and transparently runs it as Python for better performance. The second button runs it line by line transparently. Generally, the Run button can be used except if you need to debug the program with the step-by-step mode.

Components

The main GUI uses the PyQt 5 framework and the Pyqode widget for the code editor.

The math library uses NumPy for a few functions.

The plot window uses Matplotlib.

Turing: Another Take on Algorithm and Python Development

A cross-platform algorithm/pseudocode and Python development environment with debugging features

Posted on 27-04-2018 

Comment:

To comment you must be logged in members.

Files with category

 
File suggestion for you
Loading...
File top downloads
Loading...
Loading...
Codetitle - library source code to share, download the file to the community
Copyright © 2018. All rights reserved. codetitle Develope by Vinagon .Ltd