prednote-0.16.0.0: Build and evaluate trees of predicates

Safe HaskellNone

Data.Prednote.Expressions.RPN

Description

Postfix, or RPN, expression parsing.

This module parses RPN expressions where the operands are predicates and the operators are one of and, or, or not, where and and or are binary and not is unary.

Synopsis

Documentation

data Operator Source

Constructors

OpAnd 
OpOr 
OpNot 

Instances

pushOperand :: Pdct a -> [Pdct a] -> [Pdct a]Source

parseRPN :: Foldable f => f (RPNToken a) -> Either Error (Pdct a)Source

Parses an RPN expression and returns the resulting Pdct. Fails if there are no operands left on the stack or if there are multiple operands left on the stack; the stack must contain exactly one operand in order to succeed.