Module Mathparser


module Mathparser: sig .. end
Parser for mathematical expressions


type token =
| VAL of float
| VAR of string
| PLUS
| UPLUS
| MINUS
| UMINUS
| TIMES
| DIV
| POW
| SQRT
| FLOOR
| CEIL
| ROUND
| COS
| SIN
| SINH
| COSH
| TAN
| TANH
| EXP
| LOG
| ACOS
| ASIN
| ATAN
| LN
| DEG
| LOGB
| ABS
| MODULO
| FACTORIAL
| LPAR
| RPAR
| ABSDEL
| LBRA
| RBRA
| LCUR
| RCUR
| END
| PI
| ENOT
| RANDOM
| TRUE
| FALSE
| DECSEP
| DECXPSEP
| ASSIGN
| LET
| LEQUALS
| LDIFF
| LSUP
| LINF
| LSSUP
| LSINF
| LAND
| LOR
| LNOT
| LTERN
| LTERNSEP
| LIF
| LELSE
| LTHEN
| LXOR
| INCR
| DECR
| CMD
| COMMENT
| UNIT
| PRINT

Parser for mathematical expressions
val pi : float
The trigonometric constant
val deg_to_rad : float -> float
Convert a angle in degrees to radian
val logb : float -> float -> float
Log in arbitrary base. Not too good precision
val round : float -> float
Get the integer closest to x, or 'nearest integer'
val local_vars : (string, float) Hashtbl.t
Table for local variables
val bind_local_var : string -> float -> unit
Bind a local variable to a value
val fob : bool -> float
Get a floating-point 0 or 1 from a boolean
val bof : float -> bool
Get a bool from a float
val nfb : float -> float
Normalise a floating point boolean, ie get a 0 or a 1
val fxor : float -> float -> float
floating point xor logical operator
val disp_bind : string -> float -> unit
Display a binding cleanly
val display_bindings : unit -> unit
Display all bindings
val factorial : int -> int
The factorial function. A classic.
val factorial_f : float -> float
Factorial for floating-point numbers
val complain_soft : unit -> unit
React to an error during parsing
val complain : unit -> 'a
React to error and fail
val eval_local_var : string -> float
Get the value of a local variable
val yytransl_const : int array
val yytransl_block : int array
val yylhs : string
val yylen : string
val yydefred : string
val yydgoto : string
val yysindex : string
val yyrindex : string
val yygindex : string
val yytablesize : int
val yytable : string
val yycheck : string
val yynames_const : string
val yynames_block : string
val yyact : (Parsing.parser_env -> Obj.t) array
val yytables : Parsing.parse_tables
val evalf : (Lexing.lexbuf -> token) -> Lexing.lexbuf -> float