These are the functions for RingElem input.
Let in be a string or stream (e.g. reading from file),
and R any ring.
They both return the expression read from in and evaluated in R.
ReadExpr(R, in) -- keeps reading to the end of input (so it's
convenient for reading from a string)
ReadExprSemicolon(R, in) -- stops at the semicolon (convenient for reading from file or standard input)
Recognized operations are:
+ - * / ^ ()
The expression may contain integer constants or decimals (which are read
as exact rational numbers, e.g. 1.25 is read the same as (5/4)).
The expression may contain symbols (any indices are placed after the symbol
head inside square brackets, and separated by commas).
Code is so nice it does not need any documentation! ;-)
Potentially ambiguous expressions such as 1/2/3 are accepted (without any
warning message), and interpreted as (1/2)/3.
2016
2014