0 Members and 1 Guest are viewing this topic.
I recommend you create it with a computer programming language (like lua or python) first so that you can have the concept done and then "port" it to axe because it would be somewhat more difficult to do it initially in axe because axe doesn't come with dynamic arrays (I am not implying that it should though, I like axe how it is.)
input->AA->WWhile inData(')',A) ;; in the example 3x + (7x + 4x + (3x) - (2x-1)) ;; while we have a ), this will keep looping While inData('(',W)<inData(')',A) If inData('(',W) < inData(')',A) inData('(',W) -> Z End inData('(',W) + 1 -> W ;; while the next ( we find is in front of the ), we loop. ;; When it moves behind it, we are in a new nested parentheses, so we stop looping. ;; Z is saved, so we can recall correct location. End ;; Once we are out of the second while loop, we can copy the innermost parentheses... ;; contents to another location in RAM, and zero terminate it, or length pre-pend it. ;; then we delete the contents of that paren from the source string. doing so eliminates that... ;; ), so that the first while loop returns the position of the next ) in its test, so we loop until parens... ;; are all gone.End
Ok I came up with a partial algorithm, but I may need some assistance coding it. Order of operations goes PEMDAS, so parentheses are first. So, my idea is to loop:Code: [Select]input->AA->WWhile inData(')',A) ;; in the example 3x + (7x + 4x + (3x) - (2x-1)) ;; while we have a ), this will keep looping While inData('(',W)<inData(')',A) If inData('(',W) < inData(')',A) inData('(',W) -> Z End inData('(',W) + 1 -> W ;; while the next ( we find is in front of the ), we loop. ;; When it moves behind it, we are in a new nested parentheses, so we stop looping. ;; Z is saved, so we can recall correct location. End ;; Once we are out of the second while loop, we can copy the innermost parentheses... ;; contents to another location in RAM, and zero terminate it, or length pre-pend it. ;; then we delete the contents of that paren from the source string. doing so eliminates that... ;; ), so that the first while loop returns the position of the next ) in its test, so we loop until parens... ;; are all gone.End
Nice! Didn't know that. Haven't been up to date on Axe's features before now. :p Is that the same for variable names now?
Anything else it can do?