From ca40aeecb084fb7984508907c88c30191649c93c Mon Sep 17 00:00:00 2001 From: eoussama Date: Wed, 20 Mar 2024 14:16:19 +0000 Subject: [PATCH] fixed bug --- scripts/loops.nkm | 2 +- scripts/power.nkm | 13 +++++++++++++ src/frontend/parser.ts | 1 - 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 scripts/power.nkm diff --git a/scripts/loops.nkm b/scripts/loops.nkm index 6bac203..92e609b 100644 --- a/scripts/loops.nkm +++ b/scripts/loops.nkm @@ -1,6 +1,6 @@ hear me out i is 0; -cook until (i > 10) { +cook until (i > (10 - 1)) { loncina("iteration " + bait(i)); i is i + 1; } \ No newline at end of file diff --git a/scripts/power.nkm b/scripts/power.nkm new file mode 100644 index 0000000..383337d --- /dev/null +++ b/scripts/power.nkm @@ -0,0 +1,13 @@ +let me cook power(a, b) { + hear me out result is 1; + hear me out index is 0; + + cook until (index + 1 > b) { + result is result * a; + index is index + 1; + } + + reda result; +} + +reda power(2, 3); bs Output: 8 diff --git a/src/frontend/parser.ts b/src/frontend/parser.ts index 8c510af..b73f488 100644 --- a/src/frontend/parser.ts +++ b/src/frontend/parser.ts @@ -98,7 +98,6 @@ export class Parser extends Consumer { if (this.at().type === TokenType.Equals) { this.eat(); const right = this.parseAssignmentExpression(); - this.expect(TokenType.Semicolon, new MissingDotError(this.at().location)); return { value: right,