From 5344e68963ae8da60f0cb4e085dd431026c19f21 Mon Sep 17 00:00:00 2001 From: Patricia Lisboa Date: Tue, 7 Jan 2025 00:13:06 -0300 Subject: [PATCH] refactor: change boolean values keywords --- README.md | 4 ++-- ast.c | 4 ++-- docs/the-brainrot-programming-language.md | 4 ++-- examples/boolean.brainrot | 6 +++--- examples/sizeof.brainrot | 2 +- lang.l | 4 ++-- tests/expected_results.json | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index c1b876a..7a5d6b0 100644 --- a/README.md +++ b/README.md @@ -150,8 +150,8 @@ Join our community on [Discord](https://discord.com/invite/G9BqwB3a). | chungus | union | ❌ | | nonut | unsigned | ✅ | | schizo | volatile | ✅ | -| yes | true | ✅ | -| no | false | ✅ | +| W | true | ✅ | +| L | false | ✅ | ### Builtin functions diff --git a/ast.c b/ast.c index e89f66d..65719af 100644 --- a/ast.c +++ b/ast.c @@ -1169,7 +1169,7 @@ void execute_yapping_call(ArgumentList *args) } else { - yapping("%s", val ? "yes" : "no"); + yapping("%s", val ? "W" : "L"); } return; } @@ -1231,7 +1231,7 @@ void execute_yappin_call(ArgumentList *args) } else { - yappin(val ? "yes" : "no"); + yappin(val ? "W" : "L"); } return; } diff --git a/docs/the-brainrot-programming-language.md b/docs/the-brainrot-programming-language.md index 819a70c..5cd0e85 100644 --- a/docs/the-brainrot-programming-language.md +++ b/docs/the-brainrot-programming-language.md @@ -179,8 +179,8 @@ Brainrot replaces familiar C keywords with meme-inspired slang: | chungus | union | | nonut | unsigned | | schizo | volatile | -| yes | true | -| no | false | +| W | true | +| L | false | ### 7.2. Operators diff --git a/examples/boolean.brainrot b/examples/boolean.brainrot index b4c61bd..2d2a43f 100644 --- a/examples/boolean.brainrot +++ b/examples/boolean.brainrot @@ -1,12 +1,12 @@ skibidi main { - cap nocap = yes; + cap nocap = W; edgy(nocap) { yapping("It's valid!"); } - nocap = yes && no; + nocap = W && L; yapping("nocap: ", nocap); - nocap = yes || no; + nocap = W || L; yapping("nocap: ", nocap); } \ No newline at end of file diff --git a/examples/sizeof.brainrot b/examples/sizeof.brainrot index 7a423e8..1565869 100644 --- a/examples/sizeof.brainrot +++ b/examples/sizeof.brainrot @@ -1,7 +1,7 @@ skibidi main { rizz x = 42; nonut rizz y = 100; - cap z = yes; + cap z = W; rizz size1 = maxxing(x); rizz size2 = maxxing(y); diff --git a/lang.l b/lang.l index 0eb3a7d..13ff900 100644 --- a/lang.l +++ b/lang.l @@ -102,8 +102,8 @@ extern int yylineno; ":" { return COLON; } "🚽"[^\n]* ; /* Ignore single line comments */ -"yes" { yylval.ival = 1; return BOOLEAN; } -"no" { yylval.ival = 0; return BOOLEAN; } +"W" { yylval.ival = 1; return BOOLEAN; } +"L" { yylval.ival = 0; return BOOLEAN; } [0-9]+\.[0-9]+[fF]? { if (yytext[strlen(yytext) - 1] == 'f' || yytext[strlen(yytext) - 1] == 'F') { // 'f' or 'F' suffix: float literal diff --git a/tests/expected_results.json b/tests/expected_results.json index 814e8ff..41cf89e 100644 --- a/tests/expected_results.json +++ b/tests/expected_results.json @@ -1,5 +1,5 @@ { - "boolean.brainrot": "It's valid!\nno\nyes\n", + "boolean.brainrot": "It's valid!\nL\nW\n", "fizz_buzz.brainrot": "1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n", "hello_world.brainrot": "Hello, World!\n", "sizeof.brainrot": "4\n4\n1\n",