Arithmetic evaluation: Difference between revisions

Content added Content deleted
(+ast note)
(J: expand on opening comment)
Line 1,053: Line 1,053:
=={{header|J}}==
=={{header|J}}==


Note that once you get beyond a few basic arithmetic operations, what we commonly call "mathematical precedence" stops making sense, and its primary value is that it allows polynomials to be expressed simply. Neverthless, this task deals only with simple arithmetic.
Note that once you get beyond a few basic arithmetic operations, what we commonly call "mathematical precedence" stops making sense, and its primary value is that it allows polynomials to be expressed simply (but expressing polynomials as a sequence of coefficients, one for each exponent, is even simpler).

Neverthless, this task deals only with simple arithmetic.


The implementation here uses a shift/reduce parser to build a tree structure which J happens to support for evaluation:
The implementation here uses a shift/reduce parser to build a tree structure which J happens to support for evaluation: