summaryrefslogtreecommitdiff
path: root/doc/examples
diff options
context:
space:
mode:
authorAlasdair Armstrong2018-05-08 18:28:36 +0100
committerAlasdair Armstrong2018-05-08 18:28:36 +0100
commit750d31a3e95d75a520acc736e6358d1aba7a7d92 (patch)
tree3e5d80ac75ca4a4be6ed89bcf424d20b43b88e30 /doc/examples
parent84edb79e8b16a1c8c32716b3b45004cc7469bced (diff)
More work on Sail documentation
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/overload.sail10
-rw-r--r--doc/examples/zeros.sail5
2 files changed, 15 insertions, 0 deletions
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