aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-02 07:28:42 -0500
committerMustafa Quraish <[email protected]>2022-02-02 07:37:39 -0500
commit957b054f4fd19a7f5078a5710033ce3c27a7961d (patch)
tree09e6422fad2341f5bebdb045ab871b77e4fe47ab
parentType checking of expressions / functions! (diff)
downloadcup-957b054f4fd19a7f5078a5710033ce3c27a7961d.tar.xz
cup-957b054f4fd19a7f5078a5710033ce3c27a7961d.zip
Fix examples to include return type on main function
With the fancy new type checking these are now required.
-rw-r--r--examples/binary-ops.cup2
-rw-r--r--examples/comparisons.cup2
-rw-r--r--examples/defer.cup2
-rw-r--r--examples/fibonacci.cup2
-rw-r--r--examples/functions.cup2
-rw-r--r--examples/unary-ops.cup2
6 files changed, 6 insertions, 6 deletions
diff --git a/examples/binary-ops.cup b/examples/binary-ops.cup
index 13e5083..a7a3cd2 100644
--- a/examples/binary-ops.cup
+++ b/examples/binary-ops.cup
@@ -1,3 +1,3 @@
-fn main() {
+fn main(): int {
return 2 + 5 * (12 / 4) - 1;
} \ No newline at end of file
diff --git a/examples/comparisons.cup b/examples/comparisons.cup
index d2bd41f..0106e80 100644
--- a/examples/comparisons.cup
+++ b/examples/comparisons.cup
@@ -1,3 +1,3 @@
-fn main() {
+fn main(): int {
return (5 == 3) + (5 > 4) + (1 != 2);
} \ No newline at end of file
diff --git a/examples/defer.cup b/examples/defer.cup
index e8e4778..570bfc1 100644
--- a/examples/defer.cup
+++ b/examples/defer.cup
@@ -1,4 +1,4 @@
-fn main() {
+fn main(): int {
defer print(1);
{
defer print(2);
diff --git a/examples/fibonacci.cup b/examples/fibonacci.cup
index 5bf02aa..82184f0 100644
--- a/examples/fibonacci.cup
+++ b/examples/fibonacci.cup
@@ -1,6 +1,6 @@
-fn main() {
+fn main(): int {
let a: int = 0;
let b: int = 1;
let N: int = 20;
diff --git a/examples/functions.cup b/examples/functions.cup
index 89858c6..f24b55a 100644
--- a/examples/functions.cup
+++ b/examples/functions.cup
@@ -8,6 +8,6 @@ fn sum(n: int): int {
return rec_sum(n, 0);
}
-fn main() {
+fn main(): int {
return sum(10);
} \ No newline at end of file
diff --git a/examples/unary-ops.cup b/examples/unary-ops.cup
index bdf9853..210d718 100644
--- a/examples/unary-ops.cup
+++ b/examples/unary-ops.cup
@@ -1,4 +1,4 @@
-fn main() {
+fn main(): int {
// !!10 -> 1
// ~1 -> -2
// -(-2) -> 2