operator grapheme tree #4
Labels
No labels
area
execution
area
expansion
area
parsing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
jaynuine/minishell#4
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
store operator graphemes in a diff tree, where only differing string subsections are stored, with root to leaf verticality encoding left to right order, and horizontality mapping to a greater than relation between strings (bucket comparison)
so to traverse the tree test for issubstr{operator, token} to descend, and since all strings of a layer are comparable by
>, subsequent tests should be optimised by only considering strings still in range after each comparison (chaudfroid)token := "bd"
we need not test for unnecessary possibilities ; beginning at the root layer, the character
bis betweenaandx, so we pick a value near the middle of our interval (just pick one of the middle two on even lengths) and the result of comparing the current character (b) to the chosen middle (let's saym) will inform us of which slice of the layer may hold an exact match ;since
b < m, we will be interested in the left half ; so we redefine our search bracket to this interval, and repeat until a match is found, or none is ; assuming the former, we may plunge one level deeper, and continue matching from there, offsetting the token of course by the length of the previously matched segmentthis may be overkill for the few operators we have
><>><<|and i guess
$could be implemented as one since this would allow precedence ?yea this is overkill let's just implement this naively