1
Suggestions / Re: Bot Code Analysis Tool
« on: September 17, 2010, 08:19:07 AM »
I've been doing a little work on thinking about the interpreter.
Depending on how I decide to do it, it may come before postfix/infix translations.
Speaking of postfix/infix, I need some opinions on this.
Should I go all-out parenthasizing to the point where it looks like Lisp turned into Darwinbots infix, or should I use order of operations? (PEMDAS) (Parentheses-Exponent-Multiplication-Division-Addition-Subtraction for those who might be drawing a blank here).
I really need a good idea of what people want (unless you want it to be an option).
It might even be worth thinking about using grammars or something similar to automate the translations, and to make them customizable.
By the way, I do have a way in mind to avoid the problems of unknowns when writing the interpreter.
It's kind of like an algebra system, where unknowns are left in the system as values, allowing the evaluation to progress to any number of steps.
For instance, when evaluating:
The hardest part will be dealing with code branching, but at first I can simply use the trinary a?b:c operator whenever one of those comes up (it'll be pretty ugly though).
One issue with this is that *.eye5 could (and often should) have different values for different time-steps.
The solution is to make an object to replace the string *.eye5, and have that object track which step it is from.
Then, after the code has been interpreted this way for some number of steps, the user could input the unknowns to debug their robot.
While tedious, I do believe this will be a very powerful and helpful tool when completed.
Give me some feedback so I can get a better idea of what I am aiming for here.
Depending on how I decide to do it, it may come before postfix/infix translations.
Speaking of postfix/infix, I need some opinions on this.
Should I go all-out parenthasizing to the point where it looks like Lisp turned into Darwinbots infix, or should I use order of operations? (PEMDAS) (Parentheses-Exponent-Multiplication-Division-Addition-Subtraction for those who might be drawing a blank here).
I really need a good idea of what people want (unless you want it to be an option).
It might even be worth thinking about using grammars or something similar to automate the translations, and to make them customizable.
By the way, I do have a way in mind to avoid the problems of unknowns when writing the interpreter.
It's kind of like an algebra system, where unknowns are left in the system as values, allowing the evaluation to progress to any number of steps.
For instance, when evaluating:
Code: [Select]
*.eye5 2 add
We get the result:Code: [Select]
(*.eye5 + 2)
Which would then be on the stack, and is treated as if it were just another integer value.The hardest part will be dealing with code branching, but at first I can simply use the trinary a?b:c operator whenever one of those comes up (it'll be pretty ugly though).
One issue with this is that *.eye5 could (and often should) have different values for different time-steps.
The solution is to make an object to replace the string *.eye5, and have that object track which step it is from.
Then, after the code has been interpreted this way for some number of steps, the user could input the unknowns to debug their robot.
While tedious, I do believe this will be a very powerful and helpful tool when completed.
Give me some feedback so I can get a better idea of what I am aiming for here.