This patch implements linker script expressions and also ASSERT() command (is used to check the results for this patch).
Currently I think all possible operators are supported: ^, *, /, +, -, <<, >>, &, |, (, ), +=, -=, *=, /=, <<=, >>=, &=, |=.
This gives ability to assign values to variables and perform different calculations.
Sample of what is possible to do (test.script):
x = 1 + 2 * 3 - (4 - 5) ^ 1; y = x << 2 & x | 15; z = (((x + y) - x) + y) * 2; x <<= (y + z / y); x >>= (16 & 17); x &= 0x7F; x /= (0x1278 - 4696); c = 1 >> 1; ASSERT(x - c, "Custom error text");
This will error out "Custom error text" as "x-c" expression gives 0 after evaluation here.
Test cases for all operations are provided.