test large expressions
GoogleCodeExporter opened this issue · comments
If there is a surrounding function, there is no guarantee that 12 registers
will be enough. So, we should test some really big expressions.
Original issue reported on code.google.com by felix@familie-freiberger.net
on 22 Jul 2012 at 7:23
Did Tobias verify that there are tests that force us to evaluate a
more-than-2048-operand expression whose AST is well-balanced?
If so: Oh Shi-
If not: Don't test with more that a handful of operands.
My implementation of the project uses a variant of the Aho-Ullman-algorithm,
and SHOULD work with up to a thousand of operands.
Original comment by Nichmen...@gmail.com
on 23 Jul 2012 at 8:39
felixfreiberger: [...] Wie sieht es denn mit der Aufteilung der Register aus?
Irgendjemand hatte mir mal gesagt, dass wir im Fall eines Ausdrucks (ohne
umgebende Funktion) nie in die Situation kommen werden, dass die Register knapp
werden, solange wir "nicht verschwenderisch damit umgehen". Wie sieht das denn
aus, wenn wir eine umgebende Funktion haben?
[...]
@Tobias_Frey: [...] Damit man den Rückgabetyp frei wählen kann?
@felix: Wenn es eine Funktion gibt, gibt es keine Garantie, dass man einen
Ausdruck mit den 12 Registern berechnen kann.
felixfreiberger: Dafür dürfen wir aber auch ganz toll verschwenderisch mit
dem Speicher umgehen?
@Tobias_Frey: ja
--> Oh Shi- >:)
Original comment by felix@familie-freiberger.net
on 23 Jul 2012 at 8:51
- Changed title: test large expressions
Feel free to test this.
Suggestion from my side:
import static prog2.project4.tests.prog2tests.MassTestingBewied.*;
// Or something
// [...]
StringBuilder sb = new StringBuilder("int fooBar(int a) { return a");
for (int i = 1; i < 1234; i++) {
sb.append("+a");
}
sb.append("; }");
String text = sb.toString();
String scope = "(a)";
Program p = new Program(text, scope);
p.add(new Behavior(0, 0));
p.add(new Behavior(1, 1234));
p.add(new Behavior(2, 2468));
runWrapped(p);
But feel free to do it otherwise. ;)
Original comment by Nichmen...@gmail.com
on 24 Jul 2012 at 6:46
Tried the above thing.
The parser croaks with a StackOverflowException for 1234 operands.
=> We won't get expressions that are DEEPER than 1234 operands.
"deeper" != "more in total"
=> We won't get expressions that are DEEPER than 1234 operands, but may get
expressions that CONTAIN more than that. Up to 2^31 or something.
Original comment by Nichmen...@gmail.com
on 27 Jul 2012 at 12:40
- Changed state: Added