Library
Module
Module type
Parameter
Class
Class type
The elements of that type drive the parser telling it which input tokens are operators.
val none : (_, _) t
Tell the parser there's no operator.
val infix : ('a -> 'b option) -> associativity -> float -> ('a, 'b) t
infix is a pr
tells the parser that for any input i
, if is i
is true, then it's an infix operator with associativity a
and precedence pr
.
For example, use infix = Neither 10.
to consider the equality =
as infix with no associativity so that you can parse x = y
.
val prefix : ('a -> 'b option) -> float -> ('a, 'b) t
prefix is pr
tells the parser that for any input i
, if is i
is true, then it's a prefix operator with precedence pr
.
For example, use prefix ¬ 1.
to consider the negation ¬
as a prefix operator so that you can parse ¬ x
.
val postfix : ('a -> 'b option) -> float -> ('a, 'b) t
postfix is pr
tells the parser that for any input i
, if is i
is true, then it's a postfix operator with precedence pr
.
For example, use postfix ! 1.
to consider the factorial !
as a postfix operator so that you can parse x !
.
o <+> p
tells the parser to consider the operators specified in o
and in p
.
Note that through none
and (<+>)
, the type 'a t
is a semi-group. You can use infix
, prefix
and postfix
to generate initial values and combine them with (<+>)
.