3 ms·
That is interesting and I'm getting back late on this. But after mentally parsing that, it seems all this is doing separating blocks. What one would want to al
by joe_the_user 13y ago
That is interesting and I'm getting back late on this.
But after mentally parsing that, it seems all this is doing separating blocks. What one would want to also do is to also scan operators, if one was evaluating code or transforming it into an abstract syntax tree.
- draegtun 13y agoI've been on holiday since I left my last reply so also getting back late on this :) Everything in Rebol is just blocks of words, where (in general) expressions are evaluated from left to right; however, within each expression evaluation occurs from right to left [1]. So (infix) operators are also just words and have no precedence order so they just evaluate left to right (like Smalltalk) when parsed [2]... >> 1 + 2 * 3 == 9 To enforce any precedence you use paren! blocks [3], which are blocks that get evaluated immediately. >> 1 + (2 * 3) == 7 refs: [1] http://www.rebol.com/r3/docs/guide/code-eval.html http://www.rebol.com/r3/docs/guide/code-eval.html [2] http://www.rebol.com/r3/docs/concepts/math-precedence.html http://www.rebol.com/r3/docs/concepts/math-precedence.html [3] http://www.rebol.com/r3/docs/datatypes/paren.html http://www.rebol.com/r3/docs/datatypes/paren.html