Constant Folding is a technique in which the compiler computes expressions with constant terms before run time, thus speeding up execution.
For example, given an expression (10 + 11) * 2, the compiler would essentially transform that into the expression 42. For partial computations, e.g. (10 + 11) * x, the compiler will do as much as it can: 21 * x.
Since this is going in version v0.1.0, where there are no variables or statements and an entire Solid program consists of a single numerical expression, the compiler will compute the entire expression and simply print a single number as the compiled output.
Constant Folding is a technique in which the compiler computes expressions with constant terms before run time, thus speeding up execution.
For example, given an expression
(10 + 11) * 2
, the compiler would essentially transform that into the expression42
. For partial computations, e.g.(10 + 11) * x
, the compiler will do as much as it can:21 * x
.Since this is going in version v0.1.0, where there are no variables or statements and an entire Solid program consists of a single numerical expression, the compiler will compute the entire expression and simply print a single number as the compiled output.