Index of values


A
aexpr_to_string [Printer]
aexpr_to_string returns the canonical string representation of an annotated 3110Caml expression.
alpha_vary [Infer]
alpha_vary is used to rename a type with fresh type variables.
annotate [Infer]
The annotate function is used to type annotate the expressions that are returned by the parser to ensure that they are semantically valid in 3110Caml.
apattern_to_string [Printer]
apattern_to_string returns the canonical string representation of an annotated 3110Caml pattern.
apply [Unify]
apply s t applies the substitution s to the type t, right to left.

C
circular [Exceptions]
circular is a helper function that is used to throw the CircularDefinition exception.
collect [Infer]
collect collects a list of constraints generated by an annotated expressions for unification.
commands [Repl]
commands is the list of commands available to the user.
concat [Eval]
concat env env' concatenates the environments env and env'.
const_to_string [Printer]
const_to_string returns the string representation of a 3110Caml constant.
constr_to_string [Printer]
constr_to_string prints out the canonical string representation of a constraint for unification.
constraints_to_string [Printer]
constraints_to_string prints a list of constraints.

D
debug [Printer]
The debug flag is used to enable all of the debug_print statements that appear throughout the codebase.
debug_print [Printer]
debug_print is used to print a string based on the value of the debug flag.
diag [Streams]
diag ss takes a stream of streams and returns a stream of the diagonal elements.

E
eval [Eval]
eval contains the main logic for evaluating 3110Caml expressions.
eval_arith [Eval]
eval_arith is a helper function used to evaluate purely arithmetic expressions in 3110Caml.
eval_bool [Eval]
eval_bool is similar to eval_arith, but is used for boolean expressions.
eval_comp [Eval]
eval_comp is similar to eval_arith, but is used for expressions involving the polymorphic comparison operators.
eval_def [Repl]
eval_def is used to evaluate a toplevel definition.
expr_to_string [Printer]
expr_to_string e prints the canonical string representation of a given 3110Caml expression.

F
fibs [Streams]
fibs is a stream whose nth element is the nth fibonacci number.
fork [Streams]
fork is a combinator for executing two functions on the same input and returning the results.

H
handle_file [Repl]
handle_file is used exlusively to handle the Use <filename> directive.
hd [Streams]
hd returns the first element of a stream.

I
inexhaustive [Exceptions]
inexhaustive is used to raise the InexhaustiveMatch exception.
infer [Infer]
The infer function combines the annotation and unification phases to accomplish type inference for 3110Caml expressions.
interleave [Streams]
interleave s t returns a stream with the elements of s and t in alternating order.

L
look_and_say [Streams]
look_and_say is a stream whose nth element is the nth number in the look-and-say sequence.

M
main [Main]
main is the entry point of the interpreter.
map [Streams]
map f s creates a new stream by applying f to each element of s.

N
next_type_var [Infer]
next_type_var () returns a fresh type variable wrapped in the TVar constructor.

O
occurs [Unify]
The occurs function is used to figure out if a given identifier occurs within a given type.
opstring_of_binop [Printer]
opstring_of_binop op takes a binary operator and returns the string representation of that operator.
opstring_of_unop [Printer]
opstring_of_unop op takes a unary operator and returns the string representation of that operator.

P
parse_definition [Repl]
parse_definition parses the input string to a definition.
parse_error [Exceptions]
parse_error is used to raise the ParseError exception.
parse_expression [Repl]
parse_expression parses the input string to an expression.
parse_toplevel [Repl]
parse_toplevel s calls the Parser on the string s with entry point toplevel_input to the grammar.
pattern_match [Eval]
pattern_match v p takes the value v and the pattern p and outputs the following data: A bool that indicates whether the v matches the pattern p., An environment that contains the bindings of the variables in the pattern that witness the match.
pattern_to_string [Printer]
pattern_to_string p prints the canonical string representation of a given 3110Caml pattern.
pi [Streams]
pi is a stream that contains a sequence of approximations that converge to the real number pi.
print [Printer]
print to_string value prints to_string value to standard output.
print_constraint [Printer]
print_constraint c prints the constraint c to standard output.
print_list [Printer]
print_list to_string values prints each of the values in values on a new line to standard output.
print_substitution [Printer]
print_substitution s prints the substitution s to standard output.
print_type [Printer]
print_type t prints the type t to standard output.
print_val [Printer]
print_val v prints the value v to standard output.

R
repeat [Streams]
repeat x returns a stream that has every element equal to x.
repl [Repl]
repl env fvs is the entry point for the REPL loop.
reset_type_vars [Infer]
reset_type_vars resets the values of the type variables back to 'a.
runtime_error [Exceptions]
runtime_error is used to raise the RuntimeError exception.

S
show_binop [Printer]
show_binop is used to print out expressions involving binary operators.
show_circular [Exceptions]
show_circular is used to print out a helpful error message for circular types.
show_inexhaustive [Exceptions]
show_inexhaustive is used to print out a helpful error message for inexhaustive match cases.
show_parse_error [Exceptions]
show_parse_error is used to print out a helpful error message for parse errors.
show_runtime_error [Exceptions]
show_runtime_error is used to print out a helpful error message for runtime errors.
show_type_error [Exceptions]
show_type_error is used to print out a helpful error message for type errors.
show_unbound [Exceptions]
show_unbound is used to print out a helpful error message for unbound variable exceptions.
show_undefined [Exceptions]
show_undefined is used to print out a helpful error message for undefined value exceptions.
show_unify_error [Exceptions]
show_unify_error is used to print out a helpful error message for unification errors.
string_of_list [Printer]
string_of_list lst returns the string representation of the 3110Caml list, lst.
subst [Unify]
subst t x t' substitutes the type t for all occurences of the type variable x in type t'.
subst_to_string [Printer]
subst_to_string prints out the canonical string representation of a substitution.
suffixes [Streams]
suffixes s returns a stream whose nth element is the substream of s starting at the nth element of s.

T
take [Streams]
take n s returns the first n elements of the stream s in a list.
tl [Streams]
tl returns the stream without its first element
type_error [Exceptions]
type_error is used to raise the TypeError exception.
type_of [Infer]
type_of e returns the type associated with the annotated expression e.
type_of_pattern [Infer]
type_of_pattern p returns the type associated with the annotated pattern p.
type_to_string [Printer]
type_to_string returns the canonical string representation of a 3110Caml type.

U
unbound_var [Exceptions]
unbound_var is used to raise the UnboundVariable exception.
undefined [Exceptions]
undefined is used to raise the UndefinedValue exception.
unfold [Streams]
unfold f s takes the seed s and a function f that produces a tuple containing two values: a value to be placed into the stream, and, the next seed. The function f is applied successively to generate all of the values of the stream.
unify [Unify]
The unify function takes a list of constraints and finds a substitution that satisfies all of the constraints.
unify_error [Exceptions]
unify_error is used to raise the UnificationError exception.
univ [Streams]
The univ function is the composition of unfold and fork.
update [Eval]
update x v env updates the value of the identifier x to the value v in the environment env.

V
val_to_string [Printer]
val_to_string returns the canonical string representation of a 3110Caml value.
vcompare [Eval]
vcompare is the analog to OCaml's Pervasives.compare.