diff --git a/AlgebraicDataflowArchitectureModel/src/parser/Parser.java b/AlgebraicDataflowArchitectureModel/src/parser/Parser.java index b807c62..93e0ffc 100644 --- a/AlgebraicDataflowArchitectureModel/src/parser/Parser.java +++ b/AlgebraicDataflowArchitectureModel/src/parser/Parser.java @@ -454,14 +454,14 @@ // lower priority than add and sub if (first != null) monomials.add(first); Expression firstMonomial = monomials.get(0); - i = 1; + int j = 1; for (Symbol op2: addSubs) { - Expression secondMonomial = monomials.get(i); + Expression secondMonomial = monomials.get(j); Term term = new Term(op2); term.addChild(firstMonomial); term.addChild(secondMonomial); firstMonomial = term; - i++; + j++; } if (rootTerm == null) { rootTerm = new Term(op); @@ -474,6 +474,7 @@ } monomials.clear(); addSubs.clear(); + first = second; } else { // add or sub ==> new monomial monomials.add(first);