Arithmetic evaluation: Difference between revisions

J: minor bit of explanation
(J: minor bit of explanation)
Line 1,172:
 
You can also display the syntax tree, for example:
<lang j> parse '1+1'</lang>
┌─────────────────────────┬───────┐
│┌───┬───────┬───┬───────┐│┌─┬─┬─┐│
││┌─┐│┌─────┐│┌─┐│┌─────┐│││1│2│3││
│││$│││┌─┬─┐│││+│││┌─┬─┐│││└─┴─┴─┘│
││└─┘│││0│1│││└─┘│││0│1││││ │
││ ││└─┴─┘││ ││└─┴─┘│││ │
││ │└─────┘│ │└─────┘││ │
│└───┴───────┴───┴───────┘│ │
└─────────────────────────┴───────┘</lang>
 
At the top level, the first box is a list of terminals, and the second box represents their parsed structure, with numbers indexing the respective terminals.
 
=={{header|Lua}}==
6,962

edits