Hi I have a project in which I have to build an algorithm visualization tool. Up until now I have been going in a static direction thinking of having in built menus that allowed a user to create an animation of a sorting algorithms but now my tutor wants me to make the tool more dynamic by allowing user defined algorithms that is my tool should be able to animate user defined algorithms. However I have no real idea of how to do this, I searched around a lot and guessed that I would allow the user to type the user defined algorithm in java and then have to parse the algorithm he/she entered and compile it and generate the animation. I am thinking of using JavaCC to generate a parser for the java programming language itself but I am not sure how to include it the parser and compiler in my project. Any help would be greatly appreciated. Thanks!

Hi thanks for the reply.
I think I will stick to having the user code the algorithm in Java itself. The user will type the code for example in an integrated editor and will save the file. I am planning to compile and run the saved source file from my main program. Below is a link that explains how to do this:
http://www.javabeat.net/articles/73-the-java-60-compiler-api-1.html

That is the user will use the classes that I supply with my program to code the user defined algo, then save it as a .java file and compile it. However since I will be using the Compiler class, is there any issues for trouble here? Also since I am using eclipse and swing to develop the project I don't know if there are other implications to make the classes that I will implement(the data structures and their methods) readily available for the user to use in the user-defined algo.

This article has been dead for over six months. Start a new discussion instead.