Description
Considering the expression (1 + 2) * (3 + 4)
.
While it is correct that 1 + 2
has to be reduced first, the way the stepper visualizes this contraction by removing parentheses can create confusion to some students as shown in the picture (like why wouldn't 2 * 3
be reduced first due to PEMDAS rule).
On the other hand, the stepper tries to add unnecessary parentheses (as shown in the video).
Source.Academy.Mozilla.Firefox.2025-03-02.21-11-08.mp4
There might be an issue with parentheses insertion. Hopefully, this will be resolved in a future version of the stepper.
Because the sourceRunner uses the Acorn parser without Parenthesized Expressions to prevent unnecessary parentheses, the current stepper must convert the parsed AST to a string and add parentheses where needed. Readding parenthesized AST might help, but there should be a better solution.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status