Infix expression parser using Shunting Yard algorithm.
Infix expression parser using Shunting Yard algorithm.
(parse-infix expr)Parse infix expression into postfix notation using Shunting Yard algorithm.
Parse infix expression into postfix notation using Shunting Yard algorithm.
(tokenize expr)Convert infix expression into sequence of tokens.
Convert infix expression into sequence of tokens.
(transform-function-calls expr)(transform-function-calls expr context)Transform function call syntax by detecting symbol followed by list pattern.
context tells us how to interpret the first element of expr:
:expression — a flat infix/arg-list sequence; every position is eligible
for fn(args) pattern matching.
:call — the first element is the fn/macro/special-form head of a
Clojure call form; skip pattern matching at position 0 so
cond in (cond (x = y) 1) isn't treated as fn(args).
Additionally, non-head positions are treated as independent
arguments: adjacent symbol + (list) pairs are NOT
merged into fn-calls there (that would mis-read e.g.
(.addAll list (seq items)) as (.addAll (list seq items))).
Transform function call syntax by detecting symbol followed by list pattern.
`context` tells us how to interpret the first element of `expr`:
:expression — a flat infix/arg-list sequence; every position is eligible
for fn(args) pattern matching.
:call — the first element is the fn/macro/special-form head of a
Clojure call form; skip pattern matching at position 0 so
`cond` in `(cond (x = y) 1)` isn't treated as fn(args).
Additionally, non-head positions are treated as independent
arguments: adjacent `symbol` + `(list)` pairs are NOT
merged into fn-calls there (that would mis-read e.g.
`(.addAll list (seq items))` as `(.addAll (list seq items))`).cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |