module Blang:Simple boolean languagesig
..end
The syntax is almost exactly the obvious s-expression syntax, except that:
1. Base elements do not need to be marked explicitly. Thus, if your value language had two elements, "true" and "false", then you could write the following Blang s-expressions:
true (if true true false)
and so on. Note that this can get in the way of using the blang keywords in your value language.
2. the argument lists for And and Or should not be wrapped in parens. i.e., you can write:
(and true (or true false false) (and true) (and) (not (or)))
type
'a
t =
| |
And of |
| |
Or of |
| |
Not of |
| |
If of |
| |
Base of |
include Sexpable.S1
'a
must not
look anything like blang sexps. Otherwise t_of_sexp
will fail.include Binable.S1
val values : 'a t -> 'a list
values t
forms the list containing every v
for which Base v
is a subexpression of t
val true_ : 'a t
val false_ : 'a t
include Monad
Blang.t
's monad works as follows:
return v
is the term Base v
.bind t k
is a substitution operation that replaces every
Base v
in t
with the term k v
.val eval : ('a -> bool) -> 'a t -> bool