Just a quick post to demo the UI updates.
Final Year Project
Friday, 15 February 2013
Sunday, 27 January 2013
Close the finish
It has been a long time since my last blog entry but In that time my project has come along tremendously. I will give an idea of where I am at.
The running menu allows you to alter the speed at which the code runs through, the text highlighted green represents the line currently being executed, the line will stop and turn red if an error has occurred and report it in the output window.
1. The Interpreter / Language
Well the interpreter and language are pretty much complete. I still need to implement the methods for manipulating array and list, but apart from that, any other work on this part will be sorting out any glitches I may encounter.
2. The UI
Below you can see how much progress I have made on the UI the code section is syntax highlighted and the code can be mapped into a diagram, the diagram is currently a work in progress as I need to add arrows on to show where the code is going. The option to insert code snippets also needs to be implemented, that should be quite trivial.
The running menu allows you to alter the speed at which the code runs through, the text highlighted green represents the line currently being executed, the line will stop and turn red if an error has occurred and report it in the output window.
I aim to get the final product completed within the next two weeks.
Liam
Monday, 3 December 2012
Update
I have started to link up my Interpreter to GUI, all seems to be working well. Before I had connected them together It was really difficult to test certain features of the interpreter, e.g. if statements and loops, so I jumped at the opportunity.
Using the code:
create("a")
0 -> a
At first the if statement caused a few problems at the otherwise statement was executing twice, but after a bit of tweaking with the code, I got my result, the IDE printed all the even numbers.
Using the code:
create("a")
0 -> a
while(a < 10)
if(a % 2 = 0)
printline(a)
otherwise
printline("odd")
endif
a + 1 -> a
endwhile a + 1 -> a
At first the if statement caused a few problems at the otherwise statement was executing twice, but after a bit of tweaking with the code, I got my result, the IDE printed all the even numbers.
Saturday, 10 November 2012
Testing, Operators, and Syntax Checking
Over the last few weeks I have made a big change and added new things to my project. I will start off with the use of unit testing. I had never really tried out the unit testing tools built into visual studio, so I thought this would be the perfect opportunity to do so. It has proven to be a huge help allowing me to check different use cases and tweak code where necessary so that all the tests pass.
The big change I have made is the way operators are handled. I have decided to treat operators as a type of function, sort of like a proxy for another function, so for example the operator "+" can be used like 2+2, but really it is just a function pointing to another function, which in the case of "+" would be "add", which could be also called like add(2 2).
My final thing to report is the implementation of syntax checking. I have designed a simple way to ensure syntax is correct using a process that utilises numbers on a stack and goes as follows: functions set the next number to push based on their amount of arguments, "(" push the next number onto the stack then reset it to 1, operators count for 1, and everything else counts for -1 (the ")" also pops the stack).
For the expression add(2 (4 - 1)), the process would be:
1. nextStart = 1 | stack = [1]
2. "add" takes two arguments set the next start (nextStart = 2, stack = [1])
3. "(" pushed nextStart value onto the stack and resets it (nextStart = 1, stack = [1 2])
4. "2" counts for -1 decrease stack (nextStart = 1, stack = [1 1])
5. "(" pushed nextStart value onto the stack and resets it (nextStart = 1, stack = [1 1 1])
6. "4" counts for -1 decrease stack (nextStart = 1, stack = [1 1 0])
7. "-" counts for 1 increase stack (nextStart = 1, stack = [1 1 1])
8. "1" counts for -1 decrease stack (nextStart = 1, stack = [1 1 0])
9. ")" pop value off the stack and decrease -1 (nextStart = 1, stack = [1 0])
10. ")" pop value off the stack and decrease -1 (nextStart = 1, stack = [0])
Combining this process with a set of rules I am able to check the last number on the stack to identify bad syntax, an example would be, if the last element on the stack is 0 I know that the last token was not an operator.
The big change I have made is the way operators are handled. I have decided to treat operators as a type of function, sort of like a proxy for another function, so for example the operator "+" can be used like 2+2, but really it is just a function pointing to another function, which in the case of "+" would be "add", which could be also called like add(2 2).
My final thing to report is the implementation of syntax checking. I have designed a simple way to ensure syntax is correct using a process that utilises numbers on a stack and goes as follows: functions set the next number to push based on their amount of arguments, "(" push the next number onto the stack then reset it to 1, operators count for 1, and everything else counts for -1 (the ")" also pops the stack).
For the expression add(2 (4 - 1)), the process would be:
1. nextStart = 1 | stack = [1]
2. "add" takes two arguments set the next start (nextStart = 2, stack = [1])
3. "(" pushed nextStart value onto the stack and resets it (nextStart = 1, stack = [1 2])
4. "2" counts for -1 decrease stack (nextStart = 1, stack = [1 1])
5. "(" pushed nextStart value onto the stack and resets it (nextStart = 1, stack = [1 1 1])
6. "4" counts for -1 decrease stack (nextStart = 1, stack = [1 1 0])
7. "-" counts for 1 increase stack (nextStart = 1, stack = [1 1 1])
8. "1" counts for -1 decrease stack (nextStart = 1, stack = [1 1 0])
9. ")" pop value off the stack and decrease -1 (nextStart = 1, stack = [1 0])
10. ")" pop value off the stack and decrease -1 (nextStart = 1, stack = [0])
Combining this process with a set of rules I am able to check the last number on the stack to identify bad syntax, an example would be, if the last element on the stack is 0 I know that the last token was not an operator.
Thursday, 18 October 2012
So Far...
Initially I had planned on programming my project in Java, mainly due to its portability. But after thinking about the major part that visuals play, I have decided to switch to C#. My main reason for this is that I feel I would be able to create a much richer visual experience using WinForm or WPF, than using Swing.
In my last post I mentioned that I created a parser over the weekend for a knowledge exercise, but I thought if if start to structure it now I will be able to use it in my project. Here is a class diagram showing the current structure.
I am currently working on the Syntactical Analyser, although I will need to redo the other parts soon as they are all written in Java.
In my last post I mentioned that I created a parser over the weekend for a knowledge exercise, but I thought if if start to structure it now I will be able to use it in my project. Here is a class diagram showing the current structure.
I am currently working on the Syntactical Analyser, although I will need to redo the other parts soon as they are all written in Java.
Sunday, 14 October 2012
The Beginning pt.2
Just a quick extension to yesterday's post.
Over the last couple of weeks I have been preparing for my project. I have mainly been thinking of questions that will me help understand how novice programmers approaches a problem.
Currently most of the questions come in sets of three, re-phrasing the same problem in a different way. The first type is a situation that needs its processes described in words, the second is a sort of flowchart using a similar problem, and the third is a piece of programming language like pseudo code. By doing this I am able to see if the person is capable of determining the logical steps to solve a problem, but unable to understand a programming language logic due to unfamiliar syntax. Mixed in with these questions I have also created some that will help design the language, finding out how the person participating in the study would imagine things to be done, for example assignments.
One last thing, Over the weekend I have been working on a parser, mainly as a knowledge exercise, so when I come to the actual implantation I will have a starting point, but I'll post most about this later on.
Saturday, 13 October 2012
The Beginning
Hopefully this blog will help keep track of my final year project, giving an indication of my current progress.
By the end of my final year at university I hope to have designed and implemented my own programming language and IDE, with the aim of helping novice programmers understand fundamental concepts through visualisation.
Subscribe to:
Posts (Atom)



