From 987a7c553701251d48b11a2243892ecd74ce6c4d Mon Sep 17 00:00:00 2001 From: Flavian Kaufmann Date: Thu, 22 May 2025 15:16:40 +0200 Subject: [doc] added documentation in ast and hashmap headers --- examples/gcd.imp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 examples/gcd.imp (limited to 'examples') diff --git a/examples/gcd.imp b/examples/gcd.imp new file mode 100644 index 0000000..5ab0bbf --- /dev/null +++ b/examples/gcd.imp @@ -0,0 +1,16 @@ +/* computes greatest common divisor (gcd) of a and b */ +procedure gcd(a, b; r) begin + if b = 0 then + r := a; + else + q := a; + while q >= b do + q := q - b; + end; + gcd(b, q; r); + end; +end; + +x := 48; +y := 18; +gcd(x, y; result); -- cgit v1.2.3