Closed crowlogic closed 6 months ago
in NAryOperation
protected String parseFactorExpression()
{
int length = expression.expression.length();
int startPos = expression.position;
/**
* TODO: read until first rightArrow character, the chars between the operator
* symbol and the arrow are the indexing-variable, when it gets to the end of
* the expression and the range is expressed {n=a...b} the variable n must match
* the name that was designated with the arrow , this keeps the parser markovian
* so that it doesnt have to keep track of how deep the inner expression goes
* without knowing what the index variable is
*/
while (expression.character != '{' && expression.position < length)
{
expression.nextCharacter();
}
return expression.expression.substring(startPos, expression.position).trim();
}
new class arb.expressions.nodes.Variable at pos -1
parseRoot z➔Σn➔zⁿ*∏k➔α[k]₍ₙ₎{k=1…p}/n!*∏k➔β[k]₍ₙ₎{k=1…q}{n=0…N}
new class arb.expressions.nodes.nary.Sum at pos 3
Exception in thread "main" java.lang.AssertionError: TODO: set index with parseName then move the expression.position so that it points to the first character after the arrow
at arb4j/arb.expressions.nodes.nary.NAryOperation.parseFactorExpression(NAryOperation.java:178)
at arb4j/arb.expressions.nodes.nary.NAryOperation.<init>(NAryOperation.java:158)
at arb4j/arb.expressions.nodes.nary.Sum.<init>(Sum.java:35)
at arb4j/arb.expressions.Expression.evaluate(Expression.java:561)
at arb4j/arb.expressions.Expression.exponentiate(Expression.java:701)
at arb4j/arb.expressions.Expression.exponentiateMultiplyAndDivide(Expression.java:740)
at arb4j/arb.expressions.Expression.resolve(Expression.java:526)
at arb4j/arb.expressions.Expression.parseRoot(Expression.java:693)
at arb4j/arb.expressions.Compiler.express(Compiler.java:143)
at arb4j/arb.expressions.Compiler.express(Compiler.java:156)
its better to require the arrow to come after the indexing variable of a Nary operator, that makes it such that its easier to read for whoevers reading it and also the parser doesnt have to keep track of how much other { characters to ignore before it gets to the one meant for it