The modified Shunting-Yard algorithm. The modifications allow function
application by juxtaposition (without any paren around the arguments)
and distfix operators. For a normal usage, it should be enough
to import only
Text.Syntactical, not directly this module.
- data Shunt a = S [SExpr a] [Tree a] [[SExpr a]] (Rule a)
- data Failure a
- data Rule a
- initial :: [SExpr a] -> Shunt a
- isDone :: Shunt a -> Bool
- shunt :: Token a => Table a -> [SExpr a] -> Either (Failure a) (SExpr a)
- step :: Token a => Table a -> Shunt a -> Shunt a
- steps :: Token a => Table a -> [SExpr a] -> IO ()
- showFailure :: Token a => Failure a -> String
|MissingBefore [[a]] a|
missing parts before part
|MissingAfter [a] [a]|
missing parts after parts
|CantMix (Part a) (Part a)|
can't mix two operators
|MissingSubBetween a a|
missing sub-expression between parts
missing sub-expression before string
missing sub-expression after string
a part is used ambiguously in multiple operators
this is a bug if it happens
|Done (Result a)|
Parse a list of s-expressions according to an operator table.
Usually the s-expressions will be the result of applying
to each token.
Similar to the
shunt function but print the steps
performed by the modified shunting yard algorithm.
This function is useful to understand (and debug) the
modified shunting-yard algorithm.