Added lexer tests

This commit is contained in:
Pasha Bibko
2025-07-22 20:46:42 +01:00
parent 829d4c224a
commit 4d6224529f
13 changed files with 288 additions and 25 deletions

15
examples/Fib.lx Normal file
View File

@@ -0,0 +1,15 @@
int fib(int num)
{
# Base cases #
if (n == 0) { return 0 }
if (n == 1) { return 1 }
# RECURSION BABYYYY #
return fib(n - 1) + fib(n - 2)
}
int main(void)
{
int res = fib(8)
return res == 21
}

19
examples/LawsOfMath.lx Normal file
View File

@@ -0,0 +1,19 @@
int add(int a, int b)
{
return a + b
}
int main(void)
{
int c = add(3, 4)
if (c == 7)
{
return 0
}
# The laws of maths have been broken #
else
{
return 1
}
}