From 750d31a3e95d75a520acc736e6358d1aba7a7d92 Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Tue, 8 May 2018 18:28:36 +0100 Subject: More work on Sail documentation --- doc/examples/overload.sail | 10 ++++++++++ doc/examples/zeros.sail | 5 +++++ 2 files changed, 15 insertions(+) create mode 100644 doc/examples/overload.sail create mode 100644 doc/examples/zeros.sail (limited to 'doc/examples') diff --git a/doc/examples/overload.sail b/doc/examples/overload.sail new file mode 100644 index 00000000..b6213cdd --- /dev/null +++ b/doc/examples/overload.sail @@ -0,0 +1,10 @@ +val print_int : int -> unit + +val print_string : string -> unit + +overload print = {print_int, print_string} + +function main() : unit -> unit = { + print("Hello, World!"); + print(4) +} \ No newline at end of file diff --git a/doc/examples/zeros.sail b/doc/examples/zeros.sail new file mode 100644 index 00000000..7781c9ff --- /dev/null +++ b/doc/examples/zeros.sail @@ -0,0 +1,5 @@ +val zero_extend_1 : forall 'm 'n, 'm <= 'n. bits('m) -> bits('n) + +val zero_extend_2 : forall 'm 'n, 'm <= 'n. (bits('m), int('n)) -> bits('n) + +overload zero_extend = {zero_extend_1, zero_extend_2} \ No newline at end of file -- cgit v1.2.3