-
Notifications
You must be signed in to change notification settings - Fork 1
Parenthesis priority parsing walkthrough
Adam Dernis edited this page May 21, 2020
·
3 revisions
<
indicates the active_node
x+(3x+5*x)
^
----------
state_: Begin
cache_: ""
parenthesis_depth: 0
x+(3x+5*x)
^
----------
state_: Variable
cache_: ""
parenthesis_depth: 0
x+(3x+5*x)
^
----------
+ <
|
x
state_: Nary operator
cache_: ""
parenthesis_depth: 0
x+(3x+5*x)
^
----------
+
/ \
x () <
state_: Begin
cache_: ""
parenthesis_depth: 1
x+(3x+5*x)
^
----------
+
/ \
x () <
state_: Integer
cache_: "3"
parenthesis_depth: 1
x+(3x+5*x)
^
----------
+
/ \
x ()
|
* <
/ \
3 x
state_: Variable
cache_: ""
parenthesis_depth: 1
x+(3x+5*x)
^
----------
+
/ \
x ()
|
+ <
|
*
/ \
3 x
state_: Nary operator
cache_: ""
parenthesis_depth: 1
x+(3x+5*x)
^
----------
+
/ \
x ()
|
+ <
|
*
/ \
3 x
state_: Integer
cache_: "5"
parenthesis_depth: 1
x+(3x+5*x)
^
----------
+
/ \
x ()
|
+
/ \
* * <
/ \
3 x
state_: Nary operator
cache_: ""
parenthesis_depth: 1
x+(3x+5*x)
^
----------
+
/ \
x ()
|
+
/ \
* * <
/ \ |
3 x x
state_: Variable
cache_: ""
parenthesis_depth: 1
x+(3x+5*x)
^
----------
+
/ \
x () <
|
+
/ \
* *
/ \ |
3 x x
state_: Value
cache_: ""
parenthesis_depth: 0
x+(3x+5*x)
^
----------
+
/ \
x ()
|
+
/ \
* *
/ \ |
3 x x
state_: Done
cache_: ""
parenthesis_depth: 0