by throwamon · 5y ago · 0 comments
In the places where you need a list (or block), square brackets are used. for example, a classic turtle-graphics phrase:
repeat 4 [forward 10 right 90]
The primitive `repeat` takes a number and a list, and evaluates the list. The list consists of the primitive `forward`, which takes a number, and then the primitive `right` which takes a number.As for how you parse Logo expressions into a tree form, the strategy I've taken in my interpreters is "don't". Parse everything into flat lists of words, and then at interpretation time peel off words one at a time, measure their valence, and recur.