From 7eee3ca736de9fde974398a0511943329ad03943 Mon Sep 17 00:00:00 2001 From: Alex Hirsch Date: Thu, 13 Feb 2020 23:25:22 +0100 Subject: [PATCH] Add operator_precedence example --- .../operator_precedence/operator_precedence.mc | 14 ++++++++++++++ .../operator_precedence.stdin.txt | 0 .../operator_precedence.stdout.txt | 2 ++ 3 files changed, 16 insertions(+) create mode 100644 examples/operator_precedence/operator_precedence.mc create mode 100644 examples/operator_precedence/operator_precedence.stdin.txt create mode 100644 examples/operator_precedence/operator_precedence.stdout.txt diff --git a/examples/operator_precedence/operator_precedence.mc b/examples/operator_precedence/operator_precedence.mc new file mode 100644 index 0000000..8c3a182 --- /dev/null +++ b/examples/operator_precedence/operator_precedence.mc @@ -0,0 +1,14 @@ +int main() +{ + int x; + x = 4 + 3 * 5 + 6; + print_int(x); + print_nl(); + + int y; + y = 4 * 3 + 5 * 6; + print_int(y); + print_nl(); + + return 0; +} diff --git a/examples/operator_precedence/operator_precedence.stdin.txt b/examples/operator_precedence/operator_precedence.stdin.txt new file mode 100644 index 0000000..e69de29 diff --git a/examples/operator_precedence/operator_precedence.stdout.txt b/examples/operator_precedence/operator_precedence.stdout.txt new file mode 100644 index 0000000..432bba8 --- /dev/null +++ b/examples/operator_precedence/operator_precedence.stdout.txt @@ -0,0 +1,2 @@ +25 +42