coreutils icon indicating copy to clipboard operation
coreutils copied to clipboard

`expr`: evaluation should happen "during" parsing

Open tertsdiepraam opened this issue 2 years ago • 0 comments

With https://github.com/uutils/coreutils/pull/5586 merged, we can there are a few issues leftover. Here's an interesting one:

> expr '(' 1 / 0
expr: division by zero

In uutils expr, this currently gives a syntax error instead. This is because uutils first parses the entire syntax tree and evaluates it afterwards. GNU does not seem to do that. Instead, they immediately evaluate every subtree they parse. This might actually simplify the code a bit, but will be a pretty big refactor.

tertsdiepraam avatar Nov 28 '23 08:11 tertsdiepraam