Arithmetic evaluation: Difference between revisions

Content added Content deleted
m ("binary relations" -> "binary operators" (You can call addition, etc. "operators", "operations", or "functions", but certainly not "relations".))
m (add brief documentation for J)
Line 731: Line 731:


=={{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.

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

<lang j>parse=:parse_parser_
<lang j>parse=:parse_parser_
eval=:monad define
eval=:monad define