alba

Alba compiler
Library alba.core
Module Alba_core . Operator
type t
type assoc =
| Left
| Right
| No
val is_unary : string -> bool
val is_binary : string -> bool
val is_keyword_operator : string -> bool
val where : t
val assign : t

Precedence/associativity of assignment ":=".

val arrow : t

Precedence/associativity of arrow operators "->", "=>".

val colon : t

Precedence/associativity of colon ':' operator.

val relation : t

Precedence/associativity of relation operators.

val addition : t

Precedence/associativity of addition operators.

val multiplication : t

Precedence/associativity of multiplication operators.

val application : t

Precedence/associativity of function application.

val compare : t -> t -> int

compare op1 op2 compares the precedence of the operators.

val of_string : string -> t

of_string op computes the precedence information of the operator op given as a string. for unknow operators the highest precedence below function application and left associativity is returned.

val needs_parens : t option -> bool -> t -> bool

needs_parens lower is_left upper decides if the lower operand lower used as a left or right operand (indicated by the flag is_left) for upper needs parentheses.

val is_left_leaning : t -> t -> bool

is_left_leaning op1 op2

a op1 b op2 c has to be parsed as (a op1 b) op2 c

val is_right_leaning : t -> t -> bool

is_right_leaning op1 op2

a op1 b op2 c has to be parsed as a op1 (b op2 c)

val associativity : t -> assoc
val precedence : t -> int