Timeline for Boolean expression parser
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 31, 2013 at 21:02 | comment | added | Bobby |
Concatenating strings with + is definitely more expensive. The StringBuilder can extend the memory used, while + always creates new String objects when used. That means that you allocate more objects and that the garbage collector has more objects to collect.
|
|
| Dec 31, 2013 at 16:34 | comment | added | Azar |
Also, that concatenation weighed heavily on my mind, but I just wasn't sure if it was more expensive than the cost of creating a StringBuilder object. Come to think of it, s.remove("regex that matches ()",""); might be the best solution there. As far as the rest, those are some very cool suggestions and I will certainly take a look. I should mention that this IS a recursive-descent parser, just perhaps a little strange in it's implementation.
|
|
| Dec 31, 2013 at 16:28 | comment | added | Azar |
To address some of what you've pointed out, the parens method will attribute all of the imaginary starred expressions ( (*) (*) (*) ) with equal levels of nesting. It simply counts the parens that are "open" to a given operator. That's what determineOperatorPrecedenceAndLocation() uses as it's main filter. It will return the operator with the least number of parens open to it, indicating it is at the topmost level. In this case, I have also manipulated those vales slightly, as to accomodate order of operations and the selection of logical operators first.
|
|
| Dec 31, 2013 at 16:23 | vote | accept | Azar | ||
| Dec 31, 2013 at 9:32 | history | edited | abuzittin gillifirca | CC BY-SA 3.0 |
bool->boolean
|
| Dec 31, 2013 at 5:14 | history | answered | icktoofay | CC BY-SA 3.0 |