aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-01-28 18:53:30 -0500
committerMustafa Quraish <[email protected]>2022-01-28 22:38:02 -0500
commit5bcd9b6beef27cf055214791433cc752f75d4688 (patch)
treef4e90927e8649d00c8ad9c33acdd47a47571f866 /examples
parentLexer: Support inline comments (diff)
downloadcup-5bcd9b6beef27cf055214791433cc752f75d4688.tar.xz
cup-5bcd9b6beef27cf055214791433cc752f75d4688.zip
Examples: Add example for unary ops, remove type hints
We ignore the types for now anyway, so let's just leave them out
Diffstat (limited to 'examples')
-rw-r--r--examples/return-0.cup4
-rw-r--r--examples/unary-ops.cup6
2 files changed, 8 insertions, 2 deletions
diff --git a/examples/return-0.cup b/examples/return-0.cup
index 5cc8b30..22d6772 100644
--- a/examples/return-0.cup
+++ b/examples/return-0.cup
@@ -1,3 +1,3 @@
-fn main(): int {
- return 0;
+fn main() {
+ return 0;
} \ No newline at end of file
diff --git a/examples/unary-ops.cup b/examples/unary-ops.cup
new file mode 100644
index 0000000..bdf9853
--- /dev/null
+++ b/examples/unary-ops.cup
@@ -0,0 +1,6 @@
+fn main() {
+ // !!10 -> 1
+ // ~1 -> -2
+ // -(-2) -> 2
+ return -~!!10;
+} \ No newline at end of file