Cool new pic, Joeman592! I added it to my signature and to the advertisement gallery! Thanks!
Offline
[/offtopic]
So, while we're waiting on ssss and hpotter134 to finish off the interpreter, I say we start working on the code for the evaluator. First of all, I think we should have a list of operators, and a parallel list of operator precedence. This part of the program should kick in to simplify the innermost bracket. This is what I have so far:
Operator: ^ * / + - mod() % sqrt() log() sin() cos() tan() Precedence: 4 2 2 1 1 2 3 2 2 2 2 2
Basically, all multi-letter operators will have a precedence of 3, because their arguments are contained within brackets. Of course, %, synonymous to mod(), will evaluate before multiplication (precedence 2), because it's arguments are not contained within brackets. That means that 4 * 3 % 2 will evaluate 4 * ( 3 % 2 ), not ( 4 * 3 ) % 2. Also, since it has a lower precedence than exponentiation, 3 % 4 ^ 2 will remain 3 % ( 4 ^ 2 ).
I don't have time right now to post the evaluation process, but basically it would:
Scan the expression list first for operators of precedence 4, and store their locations.
Scan the list for operators of precedence 3, and store their locations.
etc.
After this is done, we evaluate from the top of the "location" list, finding the correct operator, and performing an operation relative to its previous and following neighbors.
Last edited by amcerbu (2011-05-22 01:31:15)
Offline
amcerbu wrote:
[/offtopic]
So, while we're waiting on ssss and hpotter134 to finish off the interpreter, I say we start working on the code for the evaluator. First of all, I think we should have a list of operators, and a parallel list of operator precedence. This part of the program should kick in to simplify the innermost bracket. This is what I have so far:Code:
Operator: ^ * / + - mod() % sqrt() log() sin() cos() tan() Precedence: 4 2 2 1 1 2 3 2 2 2 2 2Basically, all multi-letter operators will have a precedence of 3, because their arguments are contained within brackets. Of course, %, synonymous to mod(), will evaluate before multiplication (precedence 2), because it's arguments are not contained within brackets. That means that 4 * 3 % 2 will evaluate 4 * ( 3 % 2 ), not ( 4 * 3 ) % 2. Also, since it has a lower precedence than exponentiation, 3 % 4 ^ 2 will remain 3 % ( 4 ^ 2 ).
I don't have time right now to post the evaluation process, but basically it would:
Scan the expression list first for operators of precedence 4, and store their locations.
Scan the list for operators of precedence 3, and store their locations.
etc.
After this is done, we evaluate from the top of the "location" list, finding the correct operator, and performing an operation relative to its previous and following neighbors.
Hmmm, I had a different idea altogether.
Offline
amcerbu wrote:
Just reposting the old jobs. scratcher7_13, you should probably just wait until something needs to be done. Things marked in green have already been completed.
Progress report:
Hardmath123: I'm going to build the string-list setup engine
scimonster: Once I'm done, remove commas (like in 1,000) and replace constant's names with values.
applejack: Make specific error backgrounds
ssss: Once sci's done, add something to test for mismatched brackets and when you have something like 5√2 or (1)(2) replace them with 5*√2 or (1)*(2)
hpotter134: Once ssss is done, add something to report the innermost nested bracket set. So 1+(2+3) would report 2+3.From here, we move to computation. Once hpotter134 has finished, we simply run a script that repeatedly simplifies the innermost bracket set. This is where scratcher7_13 might get involved.
EDIT: I would be willing to work on the actual evaluation engine. I have a plan for dealing with order of operations within a set of brackets.
I thought that ssss was leaving.
Offline
scratcher7_13 wrote:
amcerbu wrote:
Just reposting the old jobs. scratcher7_13, you should probably just wait until something needs to be done. Things marked in green have already been completed.
Progress report:
Hardmath123: I'm going to build the string-list setup engine
scimonster: Once I'm done, remove commas (like in 1,000) and replace constant's names with values.
applejack: Make specific error backgrounds
ssss: Once sci's done, add something to test for mismatched brackets and when you have something like 5√2 or (1)(2) replace them with 5*√2 or (1)*(2)
hpotter134: Once ssss is done, add something to report the innermost nested bracket set. So 1+(2+3) would report 2+3.From here, we move to computation. Once hpotter134 has finished, we simply run a script that repeatedly simplifies the innermost bracket set. This is where scratcher7_13 might get involved.
EDIT: I would be willing to work on the actual evaluation engine. I have a plan for dealing with order of operations within a set of brackets.I thought that ssss was leaving.
Yeah, he quit. :'(
@amcerbu: Is "1" the first thing? According to OOO, it goes "PEMDAS" - Parentheses, exponents, multiplication/division, addition/subtraction. I want to put our multi-letter ops with ^s.
Offline
Yep, who wants the 'implied multiplication' job? You just need to check for consecutive )(, )√, [number](, )[number], and [number][constant], )[constant], ([constant]
Offline
Hardmath123 wrote:
Yep, who wants the 'implied multiplication' job? You just need to check for consecutive )(, )√, [number](, )[number], and [number][constant], )[constant], ([constant]
That could be my first job. Could I take it?
Offline
scratcher7_13 wrote:
Hardmath123 wrote:
Yep, who wants the 'implied multiplication' job? You just need to check for consecutive )(, )√, [number](, )[number], and [number][constant], )[constant], ([constant]
That could be my first job. Could I take it?
Sure! You must: inset * for implied multiplication (like 4(5+3) ) and check for mismatched brackets.
Last edited by Hardmath123 (2011-05-22 08:01:08)
Offline
applejack wrote:
Code:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()`-=[]\;',./~_+{}|:"<>?
Please don't spam. What is the relevance of that?
Offline
scimonster wrote:
applejack wrote:
Code:
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()`-=[]\;',./~_+{}|:"<>?Please don't spam. What is the relevance of that?
They're all the letters, numbers, and shift chars. Significance?
\
EDIT: Outposted
Last edited by Hardmath123 (2011-05-22 10:33:48)
Offline
Yeah, you can delete it.
Offline
applejack wrote:
http://i.imgur.com/zKzps.png
I fixed the blackness problem and rounded the edges.
Kool.
Offline
Do you want me to smooth the edges of the large banner?
Hardmath123 wrote:
applejack wrote:
http://i.imgur.com/zKzps.png
I fixed the blackness problem and rounded the edges.Kool.
Offline
Sure!
Offline
Hardmath123 wrote:
scratcher7_13 wrote:
Hardmath123 wrote:
Yep, who wants the 'implied multiplication' job? You just need to check for consecutive )(, )√, [number](, )[number], and [number][constant], )[constant], ([constant]
That could be my first job. Could I take it?
Sure! You must: inset * for implied multiplication (like 4(5+3) ) and check for mismatched brackets.
Should I add it to anything?
Offline
scimonster wrote:
@amcerbu: Is "1" the first thing? According to OOO, it goes "PEMDAS" - Parentheses, exponents, multiplication/division, addition/subtraction. I want to put our multi-letter ops with ^s.
Sorry for being unclear. The system I described ranks operations of higher precedence (things that happen first) with higher numbers.
amcerbu wrote:
Code:
Operator: ^ * / + - mod() % sqrt() log() sin() cos() tan() Precedence: 4 2 2 1 1 2 3 2 2 2 2 2
The operation with highest precedence is exponentiation ( ^ ). I would like to say again that the user must format multi-letter operations like this: sqrt(x), sin(x). That way, the value of the multi-letter operation is taken care of before moving on. Think about this:
//In this representation, position up or down indicates bracket hierarchy.
//The highest line is the innermost bracket set.
//In our project, the program will evaluate the diagram "top to bottom."
3
4 + 5 log( )
2 / sin( ) + sqrt( )
4 + ( )
Together, this makes:
4 + ( 2 / sin( 4 + 5 ) + sqrt( log( 3 ) ) )I listed multi-letter operations with a precedence of 2 because, in fact, they will execute before the rest of the "line" on which the appear. Consider 2 / sin( 4 + 5 ). sin( 4 + 5 ) will be calculated before performing the 2 / ___ part.
Hope that clears up what I said earlier.
Last edited by amcerbu (2011-05-22 17:42:12)
Offline
[ ][ ] [ ] [ ] [ ] [ ] [ ][ ] [ ] [ ] [ ][ ]
[ ] [ ] [ ] [ ] [ ][ ][ ] [ ] [ ] [ ] [ ] [ ]
[ ][ ] [ ] [ ] [ ] [ ] [ ][ ] [ ] [ ] [ ]
[ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ] [ ]
[ ][ ] [ ][ ][ ] [ ] [ ] [ ] [ ] [ ] [ ][ ]
Offline
___ ___ ___
_____ /__/\ /__/\ / /\
/ /::\ \ \:\ | |::\ / /::\
/ /:/\:\ \ \:\ | |:|:\ / /:/\:\
/ /:/~/::\ ___ \ \:\ __|__|:|\:\ / /:/~/:/
/__/:/ /:/\:| /__/\ \__\:\ /__/::::| \:\ /__/:/ /:/
\ \:\/:/~/:/ \ \:\ / /:/ \ \:\~~\__\/ \ \:\/:/
\ \::/ /:/ \ \:\ /:/ \ \:\ \ \::/
\ \:\/:/ \ \:\/:/ \ \:\ \ \:\
\ \::/ \ \::/ \ \:\ \ \:\
\__\/ \__\/ \__\/ \__\/Offline
amcerbu wrote:
Code:
___ ___ ___ _____ /__/\ /__/\ / /\ / /::\ \ \:\ | |::\ / /::\ / /:/\:\ \ \:\ | |:|:\ / /:/\:\ / /:/~/::\ ___ \ \:\ __|__|:|\:\ / /:/~/:/ /__/:/ /:/\:| /__/\ \__\:\ /__/::::| \:\ /__/:/ /:/ \ \:\/:/~/:/ \ \:\ / /:/ \ \:\~~\__\/ \ \:\/:/ \ \::/ /:/ \ \:\ /:/ \ \:\ \ \::/ \ \:\/:/ \ \:\/:/ \ \:\ \ \:\ \ \::/ \ \::/ \ \:\ \ \:\ \__\/ \__\/ \__\/ \__\/
Cool, but is it necessary?
Offline
Of coure it is. Please update the banners/codes on the first page for my improved ones!
Hardmath123 wrote:
amcerbu wrote:
Code:
___ ___ ___ _____ /__/\ /__/\ / /\ / /::\ \ \:\ | |::\ / /::\ / /:/\:\ \ \:\ | |:|:\ / /:/\:\ / /:/~/::\ ___ \ \:\ __|__|:|\:\ / /:/~/:/ /__/:/ /:/\:| /__/\ \__\:\ /__/::::| \:\ /__/:/ /:/ \ \:\/:/~/:/ \ \:\ / /:/ \ \:\~~\__\/ \ \:\/:/ \ \::/ /:/ \ \:\ /:/ \ \:\ \ \::/ \ \:\/:/ \ \:\/:/ \ \:\ \ \:\ \ \::/ \ \::/ \ \:\ \ \:\ \__\/ \__\/ \__\/ \__\/Cool, but is it necessary?
Offline
how did you do that?
amcerbu wrote:
Code:
___ ___ ___ _____ /__/\ /__/\ / /\ / /::\ \ \:\ | |::\ / /::\ / /:/\:\ \ \:\ | |:|:\ / /:/\:\ / /:/~/::\ ___ \ \:\ __|__|:|\:\ / /:/~/:/ /__/:/ /:/\:| /__/\ \__\:\ /__/::::| \:\ /__/:/ /:/ \ \:\/:/~/:/ \ \:\ / /:/ \ \:\~~\__\/ \ \:\/:/ \ \::/ /:/ \ \:\ /:/ \ \:\ \ \::/ \ \:\/:/ \ \:\/:/ \ \:\ \ \:\ \ \::/ \ \::/ \ \:\ \ \:\ \__\/ \__\/ \__\/ \__\/
Edit: I'm the first to post on two of the pages now!
Last edited by applejack (2011-05-22 23:50:14)
Offline