Archive for category Python

Scheme to Python Compiler for Android OS

                 My B.tech major project was to implement a ‘Scheme-to-Python Compiler for Android’ where the language used was Scheme (a variant of lisp ).The project aimed at developing a compiler which would translate application program written in Scheme to Python which in turn can be run on Android platform.  Here I used the concept of ‘Meta-circular Evaluator’  from SICP (Structure and Interpretation of Computer Program )  the ‘wizard book’,  to recognize each expression and then ,instead of evaluating it, my program generated the corresponding the Python expression.
                   The Python program generated was stored in the SDcard of Android SDK.
Now for Python programs to be supported on Android platform, SL4A was to be installed on Android SDK . This platform enabled python generated program to be run on the SDK providing many of the API’s provided to a full-fledged Android applications . I demonstrated my project by using a “text-to-speech” API available to Python which would process the text message to generate the corresponding speech.

     The Graphical User Interface for the compiler was designed with GTK(Gnome Tool KIt) programming tool named ‘Glade’ 

As seen above,there are two text columns.  The scheme code to be compiled is to be written in the first column.  There are four buttons to this interface. 
  1. The first button when pressed invokes the ‘DrScheme’ with the Scheme code in it.The code in scheme can be checked for correctness and run with it.
  2. The second button when pressed invokes the ‘Compiler code‘,proceeses the input scheme program and generates the correspoding python program.
  3. The third button when pressed invokes ‘IDLE’ ( a python IDE) for validating the generated python code.
  4. The fourth button with an icon of ‘Android’ copies the generated python code into the SDCard s(memory card) and starts the Android SDK. 

The source code for the above project can be downloaded from my git hub => git@github.com:rohitnjan88/S-T-A.git

  The application in Android SDK can be invoked by clicking on the SL4A  icon in the menu.  

Leave a comment