### Tag archive for "mathematical operations"

Turbo Pascal generates code for all mathemathical operations with two operands by the following procedure. The input of this procedure are left and right expression and the operation.

Expressions are one of the core elements of Turbo Pascal. Expression is everything from variables, calculations, addresses or functions. Most of the code generated by Turbo Pascal comes from expressions. Therefore, expression processing needs a lot of functions and procedures that deal with all possible cases.

These routines provide basic expression processing. Each expression is divided into simpler elements according to the operator precedence: Expression, Simple Expression, Term and Factor. Once the operation and operands are determined, the mathematical operation can be performed.

Constant sets are located into temprary buffer and expression Value holds offset to this buffer. Non-constant sets are always expanded to the stack frame. This procedure calculates operation between two constant sets.