Skip to content

Instantly share code, notes, and snippets.

@msmorgan
Created January 4, 2018 19:31
Show Gist options
  • Save msmorgan/2aeff4200f085af3073c1edd6e9f58d3 to your computer and use it in GitHub Desktop.
Save msmorgan/2aeff4200f085af3073c1edd6e9f58d3 to your computer and use it in GitHub Desktop.
term : MRule Expr
term = pure $ let (x, xs) = !multChain in
foldl (Binary Mul) x xs
where
multChain : MRule (Expr, List Expr)
multChain = do x <- factor
xs <- (do let op = match (Op Mul)
op
commit
sepBy1 op factor) <|> pure []
pure (x, xs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment